PHP Mail function fails after I upgrade my Debian
web server to jessie
. 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. So www-data
is not used.
I get below error when try to send emails using php mail function.
unable to set gid=33 or uid=0 (euid=0): forcing real = effective
Sendmail path is,
sendmail_path /usr/sbin/sendmail -t -i
and it points to 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,
LimitUIDRange 0 2000
But allowing to root
user is not recommended for shared server like mine.
Is there a better solution?
EDIT: I found an unresolved bug report of this. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=797653
Thank you!
I have resolve this issue. Actual problem is explained here https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=797653.
Solution 1:
You can install ssmtp
. Debian apt-get
will remove exim4
when install ssmtp
. So you will have to configure it to use external smtp server.
Point php
sendmail path like sendmail_path /usr/bin/ssmtp -t -i
. This could differ with different distributions.
Solution 2:
You can install esmtp
and configure it to use localhost smtp. See /etc/esmtprc
. Point php
sendmail path like sendmail_path /usr/bin/esmtp -t -i
. This could differ with different distributions.