Linux PHP 致命错误:require_once():打开所需的“Mail.php”失败(include_path='.:/usr/share/pear:/usr/share/php')

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21645774/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-07 01:58:43  来源:igfitidea点击:

PHP Fatal error: require_once(): Failed opening required 'Mail.php' (include_path='.:/usr/share/pear:/usr/share/php')

phplinuxemailpear

提问by Rajaraman

When i send mail using SMTP i am getting error like

当我使用 SMTP 发送邮件时,我收到类似的错误

PHP Fatal error: require_once(): Failed opening required 'Mail.php' (include_path='.:/usr/share/pear:/usr/share/php') in ...

PHP 致命错误:require_once(): 在 ...

How can i debug this? I have installed PEAR module correctly. Installed pear list is

我该如何调试?我已经正确安装了 PEAR 模块。安装梨列表是

Installed packages, channel pear.php.net:
=========================================
Package          Version State
Archive_Tar      1.3.11  stable
Console_Getopt   1.3.1   stable
HTML_Common      1.2.5   stable
HTML_Page2       0.6.3   beta
Mail             1.2.0   stable
PEAR             1.9.4   stable
Structures_Graph 1.0.4   stable
XML_Util         1.2.1   stable

Need to install any other pear dependences?

需要安装任何其他梨依赖吗?

Thanks in advance

提前致谢

回答by Grant

Ignore the Pear message.

忽略梨形消息。

You need to find the correct path to Mail.php.

您需要找到 Mail.php 的正确路径。

If it is in the same folder then it will look like this:

如果它在同一个文件夹中,那么它看起来像这样:

require_once('Mail.php')

If not, then use absolute path. EG:

如果没有,则使用绝对路径。例如:

require_once('/var/www/Mail.php')

Or whatever the relative path is:

或者无论相对路径是什么:

require_once('directory/Mail.php')

回答by uomopalese

Use terminal to check where Pear is installing .phpfiles. Use command pear config-get php_dirto get the right directory. Use the Pear Manual to verify you Pear configurationand for debug.

使用终端检查 Pear 安装.php文件的位置。使用命令pear config-get php_dir获取正确的目录。使用Pear 手册来验证您的 Pear 配置和调试。