Cron Manager setup issues

I have added the following to my root crontab (obviously replacing SYSTEM_ROOT with our actual system root):


*/15 * * * * php [SYSTEM_ROOT]/core/cron/run.php



However, I am getting the following error message:



MySource Error

File : [SYSTEM_ROOT]/core/include/general.inc

Line : 557

Version : 3.10.2

DB Type : pgsql



Unable to determine host for current URL [SYS0107]

------------------------------------------------------------------

User Details

------------------------------------------------------------------

Root Urls

www.example.com

test.www.example.com

------------------------------------------------------------------

Current URL

http://NO HOST/NO REQUEST URI

------------------------------------------------------------------

Back Trace

0 => array (

“function” => “sq_error_handler”,

“args” => array (

0 => 256,

1 => “Unable to determine host for current URL [SYS0107]”,

2 => “[SYSTEM_ROOT]/core/include/locale_manager.inc”,

3 => 512,

4 => array (

[Max Depth Reached]

)

)

),

1 => array (

“file” => “[SYSTEM_ROOT]/core/include/locale_manager.inc”,

“line” => 512,

“function” => “trigger_error”,

“args” => array (

0 => “Unable to determine host for current URL [SYS0107]”,

1 => 256

)

),

2 => array (

“file” => “[SYSTEM_ROOT]/core/include/general.inc”,

“line” => 1061,

“function” => “raiseerror”,

“class” => “locale_manager”,

“type” => “->”,

“args” => array (

0 => “SYS0107”,

1 => 256,

2 => array (

[Max Depth Reached]

)

)

),

3 => array (

“file” => “[SYSTEM_ROOT]/core/include/general.inc”,

“line” => 557,

“function” => “trigger_localised_error”,

“args” => array (

0 => “SYS0107”,

1 => 256

)

),

4 => array (

“file” => “[SYSTEM_ROOT]/core/include/general.inc”,

“line” => 426,

“function” => “current_url”,

“args” => array (

0 => ,

1 => 1

)

),

5 => array (

“file” => “[SYSTEM_ROOT]/core/include/mysource.inc”,

“line” => 229,

“function” => “sq_web_path”,

“args” => array (

0 => “root_url”

)

),

6 => array (

“file” => “[SYSTEM_ROOT]/core/include/init.inc”,

“line” => 214,

“function” => “init”,

“class” => “mysource”,

“type” => “->”,

“args” => array (

[Empty]

)

),

7 => array (

“file” => “[SYSTEM_ROOT]/core/cron/run.php”,

“line” => 54,

“args” => array (

0 => “[SYSTEM_ROOT]/core/include/init.inc”

),

“function” => “require_once”

)





The relevant section of code seems to be:



if (SQ_PHP_CLI) {

// being called from eg. a squiz server HIPO

$url = ‘’;

} else {

$host = array_get_index($_SERVER, ‘HTTP_HOST’, FALSE);

if (!$host) {

// try to get the host name from the HTTP_HOST server variable just in case

// if previous test failed, this one will probably not help, but before dying we try anyway

$host = array_get_index($_SERVER, ‘SERVER_NAME’, FALSE);

if (!$host) {

LINE 557 ===> trigger_localised_error(‘SYS0107’, E_USER_ERROR);

}

}



Why does this think it’s not being run from the command line, when I’m running it from cron?



Any help appreciated.



Thanks, Tom

Are you sure the PHP binary you're using is the CLI binary? What do you get if you just run:

    # php -v

Bear in mind also if you are running the crontab as root, any files created at the time the crontab runs may gain root permissions and won't be available to your apache user.

What’s the output of

    #>php -r ‘print_r(php_sapi_name()); echo “\n”;’

[quote]What’s the output of

    #>php -r ‘print_r(php_sapi_name()); echo “\n”;’

[right][post=“14284”]<{POST_SNAPBACK}>[/post][/right][/quote]



php -r ‘print_r(php_sapi_name()); echo “\n”;’

Error in argument 1, char 2: option not found r

Usage: php [-q] [-h] [-s] [-v] [-i] [-f <file>]

php <file> [args…]

-a Run interactively

-C Do not chdir to the script’s directory

-c <path>|<file> Look for php.ini file in this directory

-n No php.ini file will be used

-d foo[=bar] Define INI entry foo with value ‘bar’

-e Generate extended information for debugger/profiler

-f <file> Parse <file>. Implies `-q’

-h This help

-i PHP information

-l Syntax check only (lint)

-m Show compiled in modules

-q Quiet-mode. Suppress HTTP Header output.

-s Display colour syntax highlighted source.

-v Version number

-w Display source with stripped comments and whitespace.

-z <file> Load Zend extension <file>.



Also, I tried php -v and got:



php -v

PHP 4.3.11 (cgi) (built: Nov 8 2005 06:24:40)

Copyright © 1997-2004 The PHP Group

Zend Engine v1.3.0, Copyright © 1998-2004 Zend Technologies



I think this means I don’t have the php-cli installed? I’m running FC3 and have the following packages installed:



rpm -qa | grep php

php-pgsql-4.3.11-2.8

php-gd-4.3.11-2.8

php-4.3.11-2.8

php-pear-4.3.11-2.8



I tried yum search php and didn’t see any package that indicates a cli version. Any ideas?



Thanks, Tom

[quote]I tried yum search php and didn’t see any package that indicates a cli version. Any ideas?
[right][post=“14322”]<{POST_SNAPBACK}>[/post][/right][/quote]



There is a PHP.spec file in the Installation forum that will build a php-cli RPM for you, however if you’re not familiar with building RPMs this could be tricky. Alternatively, you may need to recompile PHP from source. The MySource Matrix command line scripts (like Cron Manager) require a CLI binary.