Run cron job in CodeIgniter and Hostgator

天涯浪子 提交于 2019-12-04 17:45:51

have you setup the correct route in config/routes.php? Try running the script from your browser (or commenting out the execution part) to make sure it's accessible with your current route/htaccess setup.

my answer comes a long time after, but it could help other people. This error is apparently well known, but there is only a quick fix for it : http://ellislab.com/forums/viewthread/227672/ It says that it happens when you autoload session library, it calls CI_Input::ip_address() which is not initialized or something like that. The quick fix is in the input class (core/Input.php Line 351 (CI 2.1.2)) :

$this->ip_address = $_SERVER['REMOTE_ADDR'];

become :

if(isset($_SERVER['REMOTE_ADDR']))
   $this->ip_address = $_SERVER['REMOTE_ADDR'];
else
   $this->ip_address = '0.0.0.0';

Hope this helps.

Check to see if Hostgator is running Apache as Fast-CGI instead of module. If that is the case, the run path to PHP may be different from what you are using.

You might see the relevant information if you check phpinfo.

Great answer by @mariek

But we can also do this by just using @ sign before the syntax.

So Just made a little change in "core/Input.php" Line #352 (CI ver. 2.2.2)

$this->ip_address = $_SERVER['REMOTE_ADDR'];

to

$this->ip_address = @$_SERVER['REMOTE_ADDR'];

and its done.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!