Require_once 通过 pear 安装邮件后停止工作

Require_once stopped working after installing mail through pear

所以在我的 Ubuntu 16.04 服务器上,我的 /var/www/html/ 目录中有几个 .php 文件,我经常做 php 数据之类的东西检索,用户登录...等我想实现一个邮件验证服务,其中我想使用gmail smtp服务,所以我通过以下命令通过pear安装了邮件:

pear install --alldeps Mail

按照 this website 中的步骤进行操作后,我重新启动了 apache2,但现在我的 php require_once 无法正常工作。我试过 include_path 也没有用。

我通过 pear uninstall mail 卸载了邮件,删除了 php 并重新安装它,希望它能恢复原来的文件,但没有成功,有谁知道发生了什么事,我该如何解决?

示例代码:require_once 'DbOperation.php';

上面的代码有效,我希望它能正常工作,因为它是我整个 php api 的关键,请不要提出解决方法。感谢任何帮助。

Dave 的回答通过检查 require_once('filename') 中的文件名解决了我的问题,其中缺少一个“)”...新手错误,我知道。

ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL);

将其放入您的 php 文件中以显示错误以找出您的问题所在。谢谢戴夫!

您尝试过的任何东西都不会导致 requirerequire_once 突然停止工作。确保您已打开所有错误报告:

ini_set('display_errors',1);
ini_set('display_startup_errors',1);
error_reporting(E_ALL);

启用错误报告后,您可能会发现其他问题(例如所需的代码)。