Cron Error

iTec

Verified User
Joined
Mar 11, 2004
Messages
32
Location
St. Albert, Alberta
A reseller client is reporting the following error on his cron jobs;

/bin/sh: line 1: /home/username/domains/thedomain.ca/public_html/cron.php:
Permission denied

It appears that he has the string properly set but is getting this error on his scripts. He has the same cron.php on a few sites and is getting the error on each of them.

I did suggest that he makes sure his file is chmod 755 based on the "Permission Denied" portion of the error message.

Any other ideas as to why he is getting this error.
 
The reseller is still having problems with this cron.php script. Here is the errors he sent me this AM

/home/username/domains/hisdomain.ca/public_html/cron.php: line 1: ?PHP
: No such file or directory

/home/username/domains/hisdomain.ca/public_html/cron.php: line 2: /*
: No such file or directory

/home/username/domains/hisdomain.ca/public_html/cron.php: line 30:
: command not found

/home/username/domains/hisdomain.ca/public_html/cron.php: line 31: */
: No such file or directory

/home/username/domains/hisdomain.ca/public_html/cron.php: line 32:
/aquota.group: Permission denied

/home/username/domains/hisdomain.ca/public_html/cron.php: line 33:
updated:: command not found

/home/username/domains/hisdomain.ca/public_html/cron.php: line 36:
backups/: is a directory

/home/username/domains/hisdomain.ca/public_html/cron.php: line 37: syntax
error near unexpected token `"/home/sites/site6/web/"'

/home/username/domains/hisdomain.ca/public_html/cron.php: line 37: `
//chdir("/home/sites/site6/web/");'

I suspect this to be a script path problem, but am not 100% positive. Here is the body of the script he is using;

*/
//chdir("/home/sites/site6/web/");

include("config.php");
include(__CFG_PATH_CODE . "loader.php");

// do the work
checkAllNotifyTasks();
checkAllActionTasks();

// send test e-mail
if (getOption("cronTestEmail")==1){
$email = getOption("adminEmail");
$subject = "CRON test message";
$text = "CRON is working on PPC";
$html = nl2br($text);
sendMailProfile("PPC admin", $email, "PPC Cron",$email, $subject, $html,$text);
}

?>

He has the path [//chdir("/home/sites/site6/web/");] the same on ALL his copies of the script and that is why I am inclined to suspect it is a problem with the script and pathes therein.

Any suggestions, help greatly appreciated.

Glen
 
What iTec's client has is no different from that. Personally, I'd suggest: require 'config.php'; :)

Regarding the errors, I imagine to get it to work iTec's client had to prepend /usr/local/bin/php to the cron exec bit. Make sure at the top of his .php file he chdirs to his webspace on the server:
PHP:
chdir('/home/username/domains/hisdomain.ca/public_html');
Otherwise, any file system object invocation not containing an absolute path is likely to be executed elsewhere? This is a wild shot, but may hit the nail on the head.
 
Thanks for the replies everyone. I continued to poke around and still believe it has to do with his script.

The script is a php script from JoMo Media for a PPC (cron.php) and when I looked at it this evening I noticed that at the top it does not have the path to php anywhere ... #!/usr/bin/php. I have suggested to the client that they do as was mentioned by John from Direct Admin Support in replies to other threads on similar problems, that he put that string at the top of his script as well as enter his cron as /usr/bin/php /path/to/file.php.

I am not sure if this will help him but we can surely try.

Thanks again Joe and Phi1 for your suggestions. :)
 
Last edited:
iTec said:
I noticed that at the top it does not have the path to php anywhere ... #!/usr/bin/php.

Thats why you need the path inn the cronjob:

/path/to/php /path/toscript

rather than just

/path/to/script

or you can add the line to the header...

Chris
 
Back
Top