[英]Launch PHP script from cron?
I know you need to put /usr/local/bin/php -f
in cron before path to php file eg 我知道您需要将
/usr/local/bin/php -f
放在cron中,然后指向php文件,例如
/10 * * * * /usr/local/bin/php -f /home/public_html/scrip.php
but should i use -q
or -f
? 但是我应该使用
-q
还是-f
?
When i run /usr/local/bin/php --help
it does not show any -q option yet many tutorials online say -q
. 当我运行
/usr/local/bin/php --help
它不显示任何-q选项,但许多在线教程都说-q
。
The -q option just suppresses output from the PHP executable. -q选项仅禁止PHP可执行文件的输出。 This is useful when running a PHP script as a cron job.
在将PHP脚本作为cron作业运行时,这很有用。 So really, you should use both.
所以确实,您应该同时使用两者。
See "man php" for more information. 有关更多信息,请参见“ man php”。
The -q
stands for quiet mode which will suppress all the HTTP headers from being sent along with it. -q
代表安静模式,它将禁止所有HTTP标头随其一起发送。 Anything outputted by the script will be just that output. 脚本输出的所有内容都只是该输出。
PHP has full documentation on command line options on their website. PHP在其网站上提供了有关命令行选项的完整文档 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.