Humhub cron job on Justhost

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?

Problem persists. I suspect there is something wrong with console application configuration. Do you see anything wrong with this configuation?




<?php


/**

 * Console Default Configuration

 *

 * This configuration file only affects only the console application.

 */


$defaults = require (dirname(__FILE__) . '/_defaults.php');

$pre_config = CMap::mergeArray($defaults, require ($defaults['params']['dynamicConfigFile']));


return CMap::mergeArray($pre_config, array(

            'preload' => array('log'),

            'behaviors' => array(

                'viewRenderer' => 'HConsoleApplicationBehavior',

            ),

            'components' => array(

                'request' => array(

                    'class' => 'HHttpRequest',

                ),

                'user' => array(

                    'class' => 'ConsoleUser',

                ),

                'log' => array(

                    'class' => 'CLogRouter',

                    'routes' => array(

                        array(

                            'class' => 'CFileLogRoute',

                            'levels' => 'error, warning',

                        ),

                    ),

                ),

            ),

            // autoloading model and component classes

            'import' => array(

                'application.models.*',

                'application.forms.*',

                'application.components.*',

                'application.vendors.yii.cli.commands.*',

                'application.libs.*',

                'application.commands.shell.*',

                'application.modules_core.user.components.*',

                'ext.EZendAutoloader.EZendAutoloader',

                'ext.migrate-command.*',

            ),

            'commandMap' => array(

                'message' => 'application.commands.shell.ZMessageCommand',

                'search_rebuild' => 'application.commands.shell.SearchIndexer.Rebuilder',

                'search_optimize' => 'application.commands.shell.SearchIndexer.Optimize',

                'integritychecker' => 'application.commands.shell.Maintain.IntegrityChecker',

                'space' => 'application.modules_core.space.console.SpaceCliTool',

                'emailing' => 'application.commands.shell.EMailing.EMailing',

                'cron' => 'application.commands.shell.ZCron.ZCronRunner',

                'cache' => 'application.commands.shell.HCacheCommand',

                'module' => 'application.modules_core.admin.console.ModuleTool',

                'update' => 'application.commands.shell.HUpdateCommand',

                'migrate' => array(

                    'class' => 'application.commands.shell.ZMigrateCommand',

                    'migrationPath' => 'application.migrations',

                    'migrationTable' => 'migration',

                ),

            ),

        ));



today i had the same error using bluehost, it worked using the following command

30 * * * * php-cli /home2/screenad/public_html/protected/yiic.php cron hourly >/dev/null 2>&1