简体   繁体   English

PHP:从cron运行脚本时路径不正确

[英]PHP: path is incorrect while running script from cron

I'm having a strange problem. 我有一个奇怪的问题。 When I call script with http request (from browser) it works as it should. 当我使用http请求(从浏览器)调用脚本时,它应能正常工作。 But when I'm calling it with cron include starts complaining on paths. 但是当我用cron调用它时,include开始在路径上抱怨。 Why can paths be ok while running the script in a common way an incorrect in cron? 为什么在以通用方式运行脚本时路径正确,但在cron中不正确? I've tried to use absolute paths, but it did not help. 我尝试使用绝对路径,但没有帮助。

就我而言,我使用如下代码解决了这个问题:

include_once __DIR__ . '/DB/mysql.php';

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM