Hi. I am new to web hosting and website management. I have a website using Humhub social script which is built on top of Yii framework. I recently moved my website from Bluehost shared hosting to Justhost shared hosting.
The website itself is running fine. My cron jobs used to be running on Bluehost but I couldn’t make it run on Justhost. The error log reads:
PHP Notice: Undefined index: SCRIPT_FILENAME in /home2/screenad/public_html/protected/vendors/yii/base/CApplication.php on line 142
Line 142 of mentioned script:
Yii::setPathOfAlias(‘webroot’,dirname($_SERVER[‘SCRIPT_FILENAME’]));
My crontab setting is:
30 * * * * /home2/screenad/public_html/protected/yiic cron hourly >/dev/null 2>&1
I did some research and it is almost obvious that super global variable $_SERVER is not getting populated when it is called from a command line application.
PHP Config page of Justhost has a note:
If you choose to use PHP 5.4, you’ll want to make sure your crons use “/usr/php/54/usr/bin/php” instead, as otherwise it will use PHP 5.2.
I am not sure this has anything to do with the error I am receiving or I don’t know where to place mentioned path in code but I thought it may be related. Does anyone have an idea what might be the problem?
Further info: I replaced $_SERVER[‘SCRIPT_FILENAME’] with hard coded path. Now I don’t get error but still not working. I placed some error_log statements in yiic.php and it seems that this statement fails:
$app=Yii::createApplication(‘HConsoleApplication’, $config);
But I don’t get any other errors. Why might Yii not be able to create console application?