php – 不能包含绝对存在的梨包(并且已安装)

前端之家收集整理的这篇文章主要介绍了php – 不能包含绝对存在的梨包(并且已安装)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我安装了Mail_Mime包.
include('Mail.PHP');
include('Mail/mime.PHP');

我收到以下错误

Warning: include(Mail.PHP) [function.include]: Failed to open stream: No such file or directory in /var/www/vhosts/domain.co.uk/httpdocs/mail_mime/index.PHP  on line 2

Warning: include() [function.include]: Failed opening 'Mail.PHP' for inclusion (include_path='.:/usr/lib/PHP/PEAR:/usr/lib/PHP/modules') in /var/www/vhosts/domain.co.uk/httpdocs/mail_mime/index.PHP on line 2

Warning: include(Mail/mime.PHP) [function.include]: Failed to open stream: No such file or directory in /var/www/vhosts/domain.co.uk/httpdocs/mail_mime/index.PHP on line 3

Warning: include() [function.include]: Failed opening 'Mail/mime.PHP' for inclusion (include_path='.:/usr/lib/PHP/PEAR:/usr/lib/PHP/modules') in /var/www/vhosts/domain.co.uk/httpdocs/mail_mime/index.PHP on line 3

这2个文件肯定在文件夹中:

/usr/lib/PHP/PEAR/Mail.PHP
/usr/lib/PHP/PEAR/Mail/mime.PHP

pear list告诉我安装了所需的软件包,并且没有遗漏的依赖项

它在你的包含路径中吗?
var_dump(get_include_path());

如果不是,请尝试手动添加内容以将其添加到包含路径:

在运行时:

$path = get_include_path() . PATH_SEPARATOR . '/usr/lib/PHP/PEAR';
set_include_path($path);

或者在PHP.ini中

include_path=".:--Whatever's here already--:/usr/lib/PHP/PEAR"

另外,如果您关心它被包含在内,为什么不使用require_once?它会阻止它被多次包含(_once部分)并导致致命错误.如果无法找到,它还会阻止执行其余的代码……

原文链接:https://www.f2er.com/php/240196.html

猜你在找的PHP相关文章