PHP Mail function fails with exim4
Asked Answered
N

2

7

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!

Nealey answered 27/3, 2018 at 10:38 Comment(1)
Are you using the same MPM? Is SElinux disabled?Gubernatorial
N
0

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.

Nealey answered 17/4, 2018 at 6:18 Comment(0)
C
0

According to the error message

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

Using root is likely not necessary, group 33 (probably www-data) should also suffice.

So you should be able to use LimitGIDRange 1 9999 instead of LimitUIDRange.

Chairmanship answered 2/4, 2018 at 19:49 Comment(1)
Thanks for the answer but I have tried LimitGIDRange and it didn't work. I'm also looking for an app that can handle emails between apache and exim.Nealey
N
0

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.

Nealey answered 17/4, 2018 at 6:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.