Cron Job Permission Issue


#1

Hi all,

I am trying to create my very simple cron job scheduled running every 10 mins, setup like this

/usr/local/php5/bin/php -f
/home//…/cron.php

cron.php

<?php $mydir = dirname(__FILE__); ?>

But then I got following error

sh: line 1: /home//…/cron.php: Permission denied

Any reason why?

Thanks


#2

Could be any number of reasons, most probably a user permission issue.

It looks like cron.php is web accessible so just use curl http://domain.com/path/cron.php to hit it from any user.


#3

Do I just type following with curl prefix?

curl http://<domain.com>//cron.php

Do I need to add following to front?

/usr/local/php5/bin/php

Thanks


#4

cURL is located at /usr/bin/curl

/usr/bin/ is in the system PATH, which means using just “curl” is fine on the commandline (or in crontab).

The following two calls will give the same result:

The -s flag suppresses any output (–silent)