I'm adding a new cronjob using the command command:
/bin/sh: /home/gbtusyll/public_html/run.php
But the command doesn't run and i get a mail stating:
/bin/sh: /home/gbtusyll/public_html/run.php: Permission denied
What is the problem?
try
chmod +x run.php
also ensure that proper owner is set (i.e. if you are logged as user, if the owner of the file is 'user' - you can do it for example by running ls -la
careful: this might be very dangerous on production evironment, however I believe this would solve your development problem. You should read more about permissions later on
Use php /home/gbtusyll/public_html/run.php
instead to run it as a PHP script instead of a regular shell script.
By itself, /bin/sh
can't run php files. The PHP parses does that. Using /bin/sh
would only work if you give the file execute permissions (+x
) and put #!/usr/bin/php
(or wherever your PHP binary is located) as the first line of the file.
Try running /usr/bin/php /home/gbtusyll/public_html/run.php
to use the PHP parser directly on your file. In this scenario, the PHP doesn't have to be executable to run.