我的服务器使用Ubuntu和PHP5以及NginX。
我使用sudo apt-get install php-pear
安装了pear,后来使用sudo pear uninstall pear
将其卸载。今天我使用sudo apt-get install libphp-phpmailer
下载了phpmailer。
我编写了用phpmailer发送电子邮件的代码。它始于:
require_once("class.phpmailer.php");
我在php.ini
和/etc/php5/cli
中编辑了/etc/php5/fpm
以设置:
include_path = ".:/usr/share/php/libphp-phpmailer"
如果我在命令行中执行这个php程序,它确实运行良好,但是如果我通过浏览器访问这个php页面,它会产生HTML500错误,我检查了error.log
文件,其中显示:
PHP message: PHP Fatal error: require_once():
Failed opening required 'class.phpmailer.php'
(include_path='.:/usr/share/php:/usr/share/pear') in ...
我喜欢这条道路怎么样?我确信我已在两个php.ini文件中编辑了include_path
。我错过了另一个配置文件吗?字符串".:/usr/share/php:/usr/share/pear"
来自哪里?
答案 0 :(得分:0)
如果您完全确定所有路径都正确,则可能是文件权限问题。
groups nginx
。运行nginx : nginx
,输出应该是class.phpmailer.php
,这意味着用户nginx存在,并且只有一个组,也就是nginx。 ls -l
的位置并运行-rw-r--r-- 1 someuser somegroup
以查看该目录中文件的权限。示例输出为:&&
,表示对所有者(someuser)授予读写访问权限,对组(某个组)具有读访问权限,对其他所有人具有读访问权限。 如果您需要进一步解释如何做到这一点,请给我一个喊叫,我会更新此说明。