CakePHP shell脚本不能作为cron作业

时间:2015-12-14 04:11:03

标签: php shell cakephp cron

我编写了一个shell脚本,当我在本地测试时,它可以很好地工作。

bin/cake myshell method

但是当我把它指定为crob时,它不能正常工作。相反,我看到了默认的蛋糕输出:

Welcome to CakePHP v3.1.4 Console
---------------------------------------------------------------
App : src
Path: /home/fantastagram/public_html/src/
PHP : 5.6.16
---------------------------------------------------------------
Current Paths:

* app:  src
* root: /home/fantastagram/public_html
* core: /home/fantastagram/public_html/vendor/cakephp/cakephp

Available Shells:

[Migrations] migrations

[CORE] i18n, orm_cache, plugin, routes, server

[app] console, instagram

To run an app or core command, type `cake shell_name [args]`
To run a plugin command, type `cake Plugin.shell_name [args]`
To get help on a specific command, type `cake shell_name --help`

Content-type: text/html; charset=UTF-8

似乎忽略了脚本的两个参数。我在cPanel中使用了cron jobs工具......

enter image description here

我做错了什么?

1 个答案:

答案 0 :(得分:1)

我打开调试,发现脚本实际上在我的参数之前出错了。我用Google搜索了错误,结果是:Cakephp 3 bin/cake bake - Undefined variable: argv

调整了php.ini配置,它运行得很好。