I’m trying to run a method by cron job, follow command:
php $HOME/public_html/environments/dev/meetfun/index.php rotinas deletephototemp
I received an email with the result of running and it presented the following problems:
Notice: Undefined index: HTTP_HOST…
Notice: Undefined index: SCRIPT_NAME ...
I tried to fix by changing the config.php to:
// You should hardcode the base url for cli, otherwise it will fails.
$config['base_url'] = "http://dev.ejsystem.com.br/meetfun/";
$root = "http://".$_SERVER['HTTP_HOST'];
$root .= str_replace(basename($_SERVER['SCRIPT_NAME']),"",$_SERVER['SCRIPT_NAME']);
$config['base_url'] = "$root";
But not work.
Beyond the errosr messages reported, it also brought me the default page and not the controller and methods passed, as if I had just run php $HOME/public_html/environments/dev/meetfun/index.php.