doubu1950 2018-06-20 19:15
浏览 81
已采纳

ARGV和ARGC不从CRON返回

I am attmepting to get argv and argc from a cron job. This is what is being retunred in the $_SERVER and they are missing.

Here is the cron:

/usr/bin/php -q /home/uopynwrukuid/public_html/test_arg.php 2 200

Here is what I get:

array(13) {
  ["SHELL"]=>
  string(31) "/usr/local/cpanel/bin/jailshell"
  ["MAILTO"]=>
  string(23) "email@email.com"
  ["USER"]=>
  string(12) "uopynwrukuid"
  ["PATH"]=>
  string(13) "/usr/bin:/bin"
  ["PWD"]=>
  string(18) "/home/h"
  ["LANG"]=>
  string(11) "en_US.UTF-8"
  ["SHLVL"]=>
  string(1) "1"
  ["HOME"]=>
  string(18) "/home/uopynwrukuid"
  ["LOGNAME"]=>
  string(12) "uopynwrukuid"
  ["_"]=>
   string(12) "/usr/bin/php"
  ["PHP_SELF"]=>
  string(0) ""
  ["REQUEST_TIME_FLOAT"]=>
  float(1529521741.2111)
  ["REQUEST_TIME"]=>
  int(1529521741)
}

Anyone know why this is happening? The script worked at some point and has now broken.

  • 写回答

1条回答 默认 最新

  • dongpo8250 2018-06-20 19:21
    关注

    Noticing you are running CPanel from your shell, CPanel has a strange habit of using php-cgi as /usr/bin/php instead of php-cli.

    php -v should return a version and (cli) in parentheses like:

    PHP 7.0.27 (cli) (built: Jan  9 2018 12:43:14) ( NTS )
    

    If you see cgi or fcgi instead, then you need to find the path to the actual cli version. I believe this is commonly located at /usr/local/bin/php on cpanel servers.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 软件测试决策法疑问求解答
  • ¥15 win11 23H2删除推荐的项目,支持注册表等
  • ¥15 matlab 用yalmip搭建模型,cplex求解,线性化处理的方法
  • ¥15 qt6.6.3 基于百度云的语音识别 不会改
  • ¥15 关于#目标检测#的问题:大概就是类似后台自动检测某下架商品的库存,在他监测到该商品上架并且可以购买的瞬间点击立即购买下单
  • ¥15 神经网络怎么把隐含层变量融合到损失函数中?
  • ¥15 lingo18勾选global solver求解使用的算法
  • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行