Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've a webserver with several sites and I'm trying to run a script by crontab but it gives me a error (126 and 127)

My script is in:


When I run the command:

php /var/www/site1/script.php

The script work as normal.

I've created a that contains


/usr/local/php5/bin/php /var/www/site1/script.php

If I run

sh Works

In crontab, I've entered this:

35 13 * * * /var/www/site1/

And I get this in syslog

Apr 12 13:35:01 webserver /USR/SBIN/CRON[13331]: (root) CMD (/var/www/site1/

Apr 12 13:35:01 webserver /USR/SBIN/CRON[13330]: (CRON) error (grandchild #13331 failed with exit status 126)

What am I doing wrong?

share|improve this question
Take a look at this post:… Looks like it's already solved. – boris quiroz Apr 12 '13 at 12:50
up vote 0 down vote accepted

You should try it this way

/usr/local/bin/php -q /path/to/your/script.php
share|improve this answer

It is a permission issue on the file as explained in the link above, change the file permission to 755

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.