Run a PHP file in a cron job using CPanel(使用 CPanel 在 cron 作业中运行 PHP 文件)
本文介绍了使用 CPanel 在 cron 作业中运行 PHP 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我只是想在 CPanel 中使用 cron 作业运行 PHP 脚本 - 这是正确的语法:
I am just trying to run a PHP script using a cron job within CPanel - is this the correct syntax:
/usr/bin/php -q /home/username/public_html/cron/cron.php >/dev/null
我没有收到任何说明 cron 已完成的电子邮件通知,我是否需要对 PHP 文件执行任何特定操作?
I am not getting any email notifications stating a cron has been completed, do I need to do anything specific with the PHP file?
推荐答案
在 crontab 系统中:
In crontab system :
/usr/bin/php
是 php 二进制路径(在某些系统中不同,例如:freebsd/usr/local/bin/php
, linux:/usr/bin/php
)/home/username/public_html/cron/cron.php
应该是你的 php 脚本路径/dev/null
应该是 cron 输出,例如:/home/username/stdoutx.txt
/usr/bin/php
is php binary path (different in some systems ex: freebsd/usr/local/bin/php
, linux:/usr/bin/php
)/home/username/public_html/cron/cron.php
should be your php script path/dev/null
should be cron output , ex:/home/username/stdoutx.txt
所以你可以通过查看 cron 输出来监控你的 cron /home/username/stdoutx.txt
So you can monitor your cron by viewing cron output /home/username/stdoutx.txt
这篇关于使用 CPanel 在 cron 作业中运行 PHP 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
沃梦达教程
本文标题为:使用 CPanel 在 cron 作业中运行 PHP 文件


猜你喜欢
- 如何在 Symfony2 中正确使用 webSockets 2021-01-01
- openssl_digest vs hash vs hash_hmac?盐与盐的区别HMAC? 2022-01-01
- PHP - if 语句中的倒序 2021-01-01
- Oracle 即时客户端 DYLD_LIBRARY_PATH 错误 2022-01-01
- Laravel 5:Model.php 中的 MassAssignmentException 2021-01-01
- 如何使用 Google API 在团队云端硬盘中创建文件夹? 2022-01-01
- PHP foreach() 与数组中的数组? 2022-01-01
- 使用 GD 和 libjpeg 支持编译 PHP 2022-01-01
- 如何从数据库中获取数据以在 laravel 中查看页面? 2022-01-01
- 覆盖 Magento 社区模块控制器的问题 2022-01-01