我正在尝试使用包含敏感信息的PHP脚本,因此我使用includes来托管webroot上方的密码。
该脚本可以通过浏览器正常运行,但是当我将其作为crob作业运行时,它会生成有关包含的错误消息。
open_basedir设置为:/ var / www / vhosts / xxx /:/ tmp / - 想知道这是否与此相关?
感谢有关如何解决此问题或解决方法的任何建议。
PHP Warning: include(../includes.php): failed to open stream: No such file or directory in /var/www/vhosts/xxx.com/httpdocs/linkedin_status.php on line 6
PHP Warning: include(../includes.php): failed to open stream: No such file or directory in /var/www/vhosts/xxx.com/httpdocs/linkedin_status.php on line 6
PHP Warning: include(): Failed opening '../includes.php' for inclusion (include_path='.:') in /var/www/vhosts/xxx.com/httpdocs/linkedin_status.php on line 6
PHP Notice: Use of undefined constant API_KEY - assumed 'API_KEY' in /var/www/vhosts/xxx.com/httpdocs/linkedin_status.php on line 88
PHP Notice: Use of undefined constant SCOPE - assumed 'SCOPE' in /var/www/vhosts/xxx.com/httpdocs/linkedin_status.php on line 89
PHP Notice: Use of undefined constant REDIRECT_URI - assumed 'REDIRECT_URI' in /var/www/vhosts/xxx.com/httpdocs/linkedin_status.php on line 91
答案 0 :(得分:2)
这对我来说总是有用......
require_once("/full/path/to/your/file/includes.php");
答案 1 :(得分:1)
你可能遇到的是Cronjob正在使用不同的php.ini,因此使用不同的设置。要确认这一点,您可以创建一个将phpinfo();
结果写入文件的php脚本。在输出中,您将看到正在使用哪个php.ini。
你可以做些什么来解决这个问题: