Relative path not working in cron PHP script

前端 未结 8 1535
甜味超标
甜味超标 2020-11-28 07:59

If a PHP script is run as a cron script, the includes often fail if relative paths are used. For example, if you have

require_once(\'foo.php\');
8条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-28 08:28

    The only chance I got "require_once" to work with cron and apache at the same time was

    require_once(dirname(__FILE__) . '/../setup.php');
    

提交回复
热议问题