简体   繁体   中英

Running PHP script with Crontab (Plesk / CentOS6)

As a customer in Plesk, I am attempting to run:

php -q /httpdocs/_external/export/test.php

From this tutorial: http://daipratt.co.uk/crontab-plesk-php/

I'm receiving the error

"php: command not found"

Is there something I need to enable from the main user or a different command I would need to use to run the script?

(also tried /bin/php with no luck, there is no php file in that dir)

"which php" -/usr/bin/php (when I use this dir I also get "no such file or dir" I guess since when I use / it's pulling from the customers root not the server root)

This answer will help you. My understanding is that Cron runs everything relative to itself, so you should always use absolute paths when running something from Cron.

Good luck, and happy holidays!

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM