简体   繁体   English

PHP邮件功能因exim4而失败

[英]PHP Mail function fails with exim4

PHP Mail function fails after I upgrade my Debian web server to jessie . Debian Web服务器升级到jessie后,PHP Mail功能失败。 The software versions are, 软件版本是,

Apache2 : 2.4 
Php : 5.6 
Exim4: 4.8

This web server has multiple websites and I use libapache2-mpm-itk module to run php by different users for each website. 这个Web服务器有多个网站,我使用libapache2-mpm-itk模块为不同的用户为每个网站运行php。 So www-data is not used. 所以没有使用www-data

I get below error when try to send emails using php mail function. 尝试使用php邮件功能发送电子邮件时,我得到以下错误。

unable to set gid=33 or uid=0 (euid=0): forcing real = effective

Sendmail path is, Sendmail路径是,

sendmail_path   /usr/sbin/sendmail -t -i 

and it points to exim, 它指向exim,

/usr/sbin/sendmail -> exim4

I found a solution from http://blog.gaiterjones.com/send-php-mail-ubuntu-upgrade/ and issue resolved when I set below setting with itk module, 我从http://blog.gaiterjones.com/send-php-mail-ubuntu-upgrade/找到了一个解决方案,当我使用itk模块设置下面的设置时问题解决了,

LimitUIDRange 0 2000

But allowing to root user is not recommended for shared server like mine. 但是不建议像我这样允许root用户使用共享服务器。

Is there a better solution? 有更好的解决方案吗?

EDIT: I found an unresolved bug report of this. 编辑:我发现了一个未解决的错误报告。 https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=797653 https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=797653

Thank you! 谢谢!

According to the error message 根据错误消息

unable to set gid=33 or uid=0 (euid=0): forcing real = effective 无法设置gid = 33或uid = 0(euid = 0):强制real =有效

Using root is likely not necessary, group 33 (probably www-data ) should also suffice. 可能没有必要使用root ,第33组(可能是www-data )也应该足够了。

So you should be able to use LimitGIDRange 1 9999 instead of LimitUIDRange . 因此,您应该能够使用LimitGIDRange 1 9999而不是LimitUIDRange

I have resolve this issue. 我已经解决了这个问题。 Actual problem is explained here https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=797653 . 实际问题在这里解释https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=797653

Solution 1: 解决方案1:

You can install ssmtp . 你可以安装ssmtp Debian apt-get will remove exim4 when install ssmtp . Debian apt-get将在安装ssmtp时删除exim4 So you will have to configure it to use external smtp server. 因此,您必须将其配置为使用外部smtp服务器。 Point php sendmail path like sendmail_path /usr/bin/ssmtp -t -i . 指向php sendmail路径,如sendmail_path /usr/bin/ssmtp -t -i This could differ with different distributions. 这可能因不同的分布而不同。

Solution 2: 解决方案2:

You can install esmtp and configure it to use localhost smtp. 您可以安装esmtp并将其配置为使用localhost smtp。 See /etc/esmtprc . 请参见/etc/esmtprc Point php sendmail path like sendmail_path /usr/bin/esmtp -t -i . 指向php sendmail路径,如sendmail_path /usr/bin/esmtp -t -i This could differ with different distributions. 这可能因不同的分布而不同。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM