[英]php cron jobs working fine on cPanel server but giving errors on non cPanel server
I have 2 server one is with cPanel and other is without cPanel 我有2个服务器,一个是cPanel,另一个是没有cPanel
i am running same php scripts as cron jobs on both servers. 我在两台服务器上都与cron作业运行相同的php脚本。
All scripts are running fine on cPanel server but on non-cPanel server i am getting file not found error
所有脚本在cPanel服务器上都可以正常运行,但是在非cPanel服务器上我file not found error
Failed opening required '../includes/config.php'
i have 15+ cron job php scripts. 我有15个以上的cron工作php脚本。
is there any way to fix this without editing all my php scripts and adding __FILE__ on all includes and required? 有什么方法可以解决此问题,而无需编辑我所有的PHP脚本并在所有包含项和必需项上添加__FILE__ ?
how all these scripts running fine on cPanel without __FILE__? 没有__FILE__,所有这些脚本如何在cPanel上正常运行?
cron可能需要从其目录中运行脚本。您可以将crontab更新为cd
到脚本目录,然后执行它,例如(示例):
0 12 * * * cd /path/to/your/script/ ; php your_script.php > /dev/null 2>&1
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.