Trying to use Crontab to execute commands at regular intervals. But crontab keeps giving the error:
/bin/sh: /var/www/html/Scripts/lib/Tasks.php: /usr/bin/php^M: bad interpreter: No such file or directory
Tasks.php:
#!/usr/bin/php
<?php
//scripts
?>
I feel like my Shebang is messed up. The main php file appears to be present in /usr/bin/php but I keep getting the error. I have been trying other shebangs from other posts but most of them are not using the combination of Centos6 php5 and apache. I just need to execute this php script every few min.
In php file shebang operator will not work as per my understanding.
You can rewrite crontab as below:
* * * * * /usr/bin/php /var/www/html/Scripts/lib/Tasks.php
You can change crontab frequency as per you need. Also please verify if php is at right place with below command:
which php
Thanks.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.