CodeIgniter: Why will Codeignitor Cron Bootstrapper not work with my CI setup?
-
I am trying to create a cron job while taking advantage of my current CI setup and the use of Controllers and Models. I am using Cron Bootstrapper (http://codeigniter.com/wiki/Cron_job_bootstrapper/) because it gives me easy access to test the process locally on-demand or be available as a traditional cron process on a server. I can reach the controller using the bootstrapper file and the command line, however, I am getting many different error messages or alerts depending on how I set up my controller. If I keep the controller as it should be with `parent::Controller();`, I get the following message: `Unable to connect to your database server using the provided settings.` The error is coming from the DB_driver.php `initialize();` method. If I remove `parent::Controller();` from the controller then I get the following alert: `<p>Severity: Warning</p><p>Message: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EDT/-4.0/DST' instead</p> <p>Filename: htdocs/cron.php</p> <p>Line Number: 122</p>` By removing the `parent::Controller();` I am not able to access any models via `$this->load->model('model');` and I get the following message: `Fatal error: Call to a member function model() on a non-object in /Applications/MAMP/htdocs/my_site/system/application/controllers/cron.php on line 9` Any info that will allow me to use the bootstrapper file with CI will be very helpful. Thanks, Tim
-
Answer:
You definitely need to call the parent constructor in your controller in order to be able to use the core libraries from CodeIgniter itself. That is, if you use your own constructor in your controller. Otherwise it isn't needed. parent::Controller(); The first error you're getting indicates that your database configuration is incorrect. Make sure everything is correct in your /application/config/database.php file.
Dennis Rasmussen at Quora Visit the source
Related Q & A:
- Will my canadian debit card work in cuba?Best solution by Yahoo! Answers
- Will my old Nextel sim work on a new Sprint Nextel phone?Best solution by Yahoo! Answers
- Will Call of Duty 4 work on a Computer?Best solution by Yahoo! Answers
- Will 'Kodak DVD-R' discs work in a DVD player if I burn movies onto them?Best solution by kodak.com
- How will my att phone/service work in germany? in the army and about to be stationed there?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.