问题描述
我已经在这里呆了几个小时了,尝试一切都没有运气.
I've been at this for hours and have tried everything with no luck.
我基本上是在尝试运行 http://docs.phpservermonitor.org/en/latest/install.html#setting-up-a-cronjob
I am basically trying to run this http://docs.phpservermonitor.org/en/latest/install.html#setting-up-a-cronjob
我正在使用MAMP,我的本地主机是用户/用户名/本地主机/服务器检查下的自定义文件夹
I'm using MAMP and my localhost is a custom folder under User/username/localhost/servercheck
到目前为止,我已经尝试过了.
What I've tried so far is.
crontab -e
添加 */1 * * * * root/usr/bin/php/Users/clientsupport1/localhost/servercheck/cron/status.cron.php
crontab -e
added */1 * * * * root /usr/bin/php /Users/clientsupport1/localhost/servercheck/cron/status.cron.php
当我键入crontab -l以查看其是否已加载时,会看到以下内容.
And when I type crontab -l to see if its loaded I see the following.
*/1 * * * * root /usr/bin/php /Users/clientsupport1/localhost/servercheck/cron/status.cron.php
但是该脚本无法运行.我什至尝试了一个简单的脚本来写入文件.依然没有.由于某种原因,cron作业无法执行.有什么想法吗?
But the script does not run. I even tried a simple script that writes to a file. Still nothing. For some reason the cron job doesn't execute. Any ideas?
推荐答案
您需要调用MAMP的PHP可执行文件,具体取决于您所运行的PHP版本.对于7.2.1,以下是正确的路径
You need to call MAMP’s PHP executable, which will depend on on the version of PHP you’re running. For 7.2.1, the following below would be the proper path
*/1 * * * * /Applications/MAMP/bin/php/php7.2.1/bin/php /Users/clientsupport1/localhost/servercheck/cron/status.cron.php
这篇关于如何使用MAMP在OSX上为PHP运行Cron作业的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!