$_SERVER['DOCUMENT_ROOT'] does not work in the php script running through cron

后端 未结 9 1700
借酒劲吻你
借酒劲吻你 2020-12-08 04:35

I use $_SERVER[\'DOCUMENT_ROOT\'].\"/lib/sft_required.php\"; to include the \'sft_required\' file in a PHP script. When I run this file using browser, it works fine but whe

9条回答
  •  情歌与酒
    2020-12-08 05:21

    $_SERVER cannot be expected to contain any of the normal values when a PHP script is run using the CLI interpreter. Either put the path in an environment variable, or pass it to the script as a command line argument.

提交回复
热议问题