【问题标题】:Issues Running CodeIgniter from CLI从 CLI 运行 CodeIgniter 的问题
【发布时间】:2014-12-16 22:12:33
【问题描述】:

我已经按照here 的指示从 cli 运行 codeigniter,但我没有任何运气让它运行。 PHP 在我的路径中,但是当我运行时

php index.php tools message

什么都没有发生。如果我尝试

php index.php/tools/message

我收到“无法打开输入文件:index.php/tools/message。”

如果我在我的 cli 上运行 php -v 我会得到 ​​p>

PHP 5.3.24 (cli) (built: Apr 10 2013 18:32:42)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2013 Zend Technologies

所以,它有 cli 支持。知道我可能做错了什么吗?

【问题讨论】:

    标签: php codeigniter command-line-interface


    【解决方案1】:

    我使用这个来运行 cron 作业

    /path/tosite/index.php memberController memberFunct
    

    你的情况

    /path/tosite/index.php tools message
    

    为你的情况 有关更多详细信息,请阅读此 https://ellislab.com/codeigniter/user-guide/general/cli.html#what

    完整的行是:

    */5 * * * * /usr/bin/php /path/tosite/index.php memberController genFunction  /dev/null 2>&1
    

    【讨论】:

    • 试试这个 wget api.example.com/index.php/controller/function
    • 我还没有在服务器上尝试它,我只是想让它在我的机器上工作。
    • 我得到了它与下面的解决方案一起工作。非常感谢您抽出时间帮助我,即使我无法实施您的解决方案!
    【解决方案2】:

    这些方法对我不起作用,所以我最终使用

    curl <full url to function>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-01-23
      • 1970-01-01
      • 2012-01-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-25
      相关资源
      最近更新 更多