当从命令行运行时脚本运行正常,但不通过cron(script runs fine when run from command line but not via cron)
我有一个运行良好的php脚本,通过SSH进入我的服务器并运行它。
然而,即使一个cron作业设置为每10分钟运行一次,php脚本也不会运行。
如何查看cron作业产生的错误?
i have a php script which runs fine when executed by SSHing into my server and running it.
however the php script doesn't seem to run even though a cron job set to run it every 10 minutes.
How do I view errors produced by cron job ?
最满意答案
请记住,cron在不同于你以前使用的工作目录中运行你的脚本。 在命令行上尝试如下所示:
cd / ./path/to/your/script.php如果失败,请正确修改脚本中的所有路径,直到它运行。 然后它将在cron中运行。
Remember that cron runs your script in a different working directory than what you're probably used to. Try something like the following on the command line:
cd / ./path/to/your/script.phpIf it fails, modify all paths in your script correctly until it runs. Then it will run in cron.
更多推荐
发布评论