dousi4148
2019-05-01 15:50
浏览 93
已采纳

通过pear安装邮件后,Require_once停止工作[复制]

This question already has an answer here:

so on my Ubuntu 16.04 server, i have a couple of .php files in my /var/www/html/ directory which i do regular php stuff such as data retrieval, user login... etc. I wanted to implement a mail verification service in which i wanted to use the gmail smtp service, so i installed mail through pear by the following command:

pear install --alldeps Mail

After following the steps in this website, i restarted apache2 and now my php require_once isn't working. I tried include_path which also didn't work.

I uninstalled mail by pear uninstall mail, deleted php and reinstalling it hoping it would get the files back as it was but no luck, does anyone know what happened and how can i fix it?

sample code: require_once 'DbOperation.php';

The above code worked and i want it to work as it is the key to my entire php api, please dont suggest a workaround. Any help is appreciated.

</div>

图片转代码服务由CSDN问答提供 功能建议

此问题已经存在 这里有一个答案:

  • 如何在PHP中获取有用的错误消息? 26个答案\ r

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

      pear install --alldeps Mail 
       
     
     

    以下 这个网站,我重新启动了apache2,现在我的php require_once无效。 我尝试了include_path也没有用。

    我通过 pear卸载邮件卸载邮件,删除了php并重新安装它希望它能将文件恢复原样 但是没有运气,有谁知道发生了什么以及如何解决?

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

    以上代码有效,我希望它能够工作,因为它是我整个php api的关键,请不要建议解决方法。 任何帮助表示赞赏。

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • duanjing3656 2019-05-01 16:38
    已采纳

    Nothing in what you've tried should be causing require or require_once to suddenly stop working. Make sure you have all error reporting turned on:

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

    With error reporting enabled you may spot a problem with something else (like the code that is being required).

    点赞 打赏 评论
  • dongxiee0744 2019-05-01 16:37

    Dave's answer solved my problem by checking the filename in require_once('filename'), which had a missing ")"... rookie mistake, i know.

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

    put this in your php file to display errors to find out what your problem is. Thank you Dave!

    点赞 打赏 评论

相关推荐 更多相似问题