PHP require_once():打开失败需要include_path [英] PHP require_once(): Failed opening required include_path
问题描述
我在 Windows 中使用 PHP 7.1.
Im using Php 7.1 in windows.
我得到的错误:
PHP Fatal error: require_once(): Failed opening required 'Suite_dev/service/v4_1/SugarWebServiceImplv4_1.php' (include_path='D:/Ampps/php-7.1/pear') in D:\Ampps\www\Suite_dev\custom\service\v4_1_custom\SugarWebServiceImplv4_1_custom.php 第 4 行
PHP Fatal error: require_once(): Failed opening required 'Suite_dev/service/v4_1/SugarWebServiceImplv4_1.php' (include_path='D:/Ampps/php-7.1/pear') in D:\Ampps\www\Suite_dev\custom\service\v4_1_custom\SugarWebServiceImplv4_1_custom.php on line 4
解决方法我在 php ini 文件中做了:
Workaround i did in php ini file:
; Windows: "\path1;\path2"
include_path = "{$path}\php-7.1\pear"
下载并安装了php pear,测试pear正常运行.
Downloaded and installed php pear and tested pear is working.
即使安装了 pear 后,我仍然出现上述错误.
Even after pear is installed, i still get above error.
也尝试过类似的东西:
include('../../../service/v4_1/SugarWebServiceImplv4_1.php');
我仍然遇到同样的错误.
Still i get the same error.
推荐答案
Sugar 中的包含通常是基于 Sugar 主文件夹的相对路径.
includes in Sugar are usually relative paths based on Sugar's main folder.
应该是这样service/v4_1/SugarWebServiceImplv4_1.php
没有一个领先的Suite_dev/
So should be
service/v4_1/SugarWebServiceImplv4_1.php
without a leading Suite_dev/
这篇关于PHP require_once():打开失败需要include_path的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!