I'm working on an application in Codeigniter and I want to make once a day cronjobs run by a series of scripts. Earlier this worked correctly on another hosting but after doing a migration has stopped working, because I have to re-create these cronjobs.
I want to run all days this file /web/_cronjobs/application/controllers/updates.php. This performs an update in the database of the internal statistics of the web and the most important, an updated sitemap. This is the code:
I am running this statement from PuTTY:
/usr/bin/php5.5 /kunden/homepages/45/*******/htdocs/web/_cronjobs/application/controllers/updates.php
But it shows me this error:
(uiserver):*********:~ > /usr/bin/php5.5 /kunden/homepages/45/d566577055/htdocs/web/_cronjobs/application/controllers/updates.php
X-Powered-By: PHP/5.5.20
Content-type: text/html
<br />
<b>Fatal error</b>: Class 'Controller' not found in <b>/homepages/45/d566577055/htdocs/web/_cronjobs/application/controllers/updates.php</b> on line <b>3</b><br />
I've made this possible solution but it still is the same as the version I use codeigniter is 1.6.1 and not 2.0:
codeigniter 2.0 Fatal error: Class 'Controller' not found in
I hope someone can help me, thanks! :)
You have put a controller class into a file and are trying to call it directly. This will not work.
The reason for your specific error is that the class Controller
has not been included. This would normally be done by CodeIgniter when you're running things through the framework. But since you appear to be directly calling the file, CodeIgniter has not been loaded and cannot help you.
Second, the code in that file is just a class. I see no code that is supposed to interact with the class or anything. Therefore nothing would happen even if the class Controller
existed.
I recommend that you read this short tutorial CodeIgniter - Running via the CLI
Try this:
/usr/bin/php5.5 /kunden/homepages/45/*******/htdocs/web/_cronjobs/index.php updates