简体   繁体   English

cakephp 3 Cron Job 在 cpanel 中不起作用

[英]cakephp 3 Cron Job not working in cpanel

I am trying to implement cron job in cakephp 3 shell script but it is not working in cpanel.我正在尝试在 cakephp 3 shell 脚本中实现 cron 作业,但它在 cpanel 中不起作用。

below is my cron job code blog is my cakephp 3 folder下面是我的 cron 工作代码blog is my cakephp 3 folder

cd /home/mmentert/public_html/abc.com/blog && bin/cake hello main cd /home/mmentert/public_html/abc.com/blog && bin/cake hello main

Cakephp 3 shell class file Cakephp 3 shell 类文件

namespace App\Shell;
use Cake\Console\Shell;
use App\Controller\UsersController;
class HelloShell extends Shell {
public function main() {
    $userinfo=new UsersController();
    $data=$userinfo->useremail();
    $this->out($data);
  }
}

I assume you are using shared hosting, the syntax suggested on CakePHP 3 Docs does not work for shared hosting, this is what worked for me我假设您使用的是共享主机,CakePHP 3 Docs 上建议的语法不适用于共享主机,这对我有用

php -q -d register_argc_argv=on /home/public_html/bin/cake.php app main

Please use your own path for cake.php file请使用您自己的 cake.php 文件路径

  • -q --no-header Quiet-mode. -q --no-header 安静模式。 Suppress HTTP header output (CGI only).禁止 HTTP 标头输出(仅限 CGI)。
  • -d --define Set a custom value for any of the configuration directives allowed in php.ini -d --define 为 php.ini 中允许的任何配置指令设置自定义值

Hope that helps.希望有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM