PHP failling to send e-mails

sky

Verified User
Joined
Nov 12, 2004
Messages
318
PHP failling to send e-mails [resolved]

Hello

Im not sure if this is a PHP problem, apache or exim related...

I just updated DA to the lastest version : 1.38.0

Im not sure at what moment the e-mails stoppped working, but now i have erreur logs in : /var/log/httpd/error_log

Examples :
Code:
2011-03-20 13:28:32 1Q1HkG-0003dv-D6 Failed to create spool file /var/spool/exim/input/G/1Q1HkG-0003dv-D6-D: Permission denied
2011-03-20 13:28:32 1Q1HkG-0003dv-D6 Failed to create spool file /var/spool/exim/input/G/1Q1HkG-0003dv-D6-D: Permission denied
2011-03-20 13:28:32 1Q1HkG-0003dv-D6 Failed to create spool file /var/spool/exim/input/G/1Q1HkG-0003dv-D6-D: Permission denied
2011-03-20 13:34:21 1Q1Hpt-0003gT-9A Failed to create spool file /var/spool/exim/input/t/1Q1Hpt-0003gT-9A-D: Permission denied
2011-03-20 13:34:21 1Q1Hpt-0003gT-9A Failed to create spool file /var/spool/exim/input/t/1Q1Hpt-0003gT-9A-D: Permission denied
2011-03-20 13:34:21 1Q1Hpt-0003gT-9A Failed to create spool file /var/spool/exim/input/t/1Q1Hpt-0003gT-9A-D: Permission denied
etc...

I tried a set_permission.sh .. no luck

I checked out the perms of /var/spool/exim :
Code:
[root@noir httpd]# cd /var/spool/exim
[root@noir exim]# ls -l
total 12
drwxr-xr-x  2 mail mail 4096 mar  9 17:22 db
drwxr-xr-x 64 mail mail 4096 mar 20 04:03 input
drwxr-xr-x 64 mail mail 4096 mar 20 04:03 msglog

I think the perms are correct.

Then i also have logs like this in mailqeue :
Code:
2011-03-20 13:33:07 Received from [email protected] H=d78-241.icpnet.pl (ewa-7pyvwc6rwnw.icpnet.pl) [77.65.78.241] P=esmtp S=1836 [email protected] T="To the job seekers"
2011-03-20 13:33:07 [email protected] R=domain_filter defer (-1): internal problem in domain_filter router (recipient is [email protected]): failure to transfer data from subprocess: status=0100 readerror='Success'
(this is a spam... but still, ...)

Versions :
Code:
Apache 2.2.17	Running
DirectAdmin 1.38.0 	Running
Exim 4.72	Running
MySQL 5.1.56	Running
Named 9.3.6	Running
ProFTPd 1.3.3d 	Running
sshd 	Running
dovecot 2.0.11 	Running
Php 5.2.17	Installed

This is a new server, with imported backups from remote server... might help you.

Im not sure where the problem is, so just ask for any other logs you might need...



Edit : What is strange is that Roundcube can send e-mails without any problem.
Its only when using PHP.
I recompiled PHP and apache but no luck.


Thx for your help,
Sky
 
Last edited:
About PHP, make a simple PHP script, that would send a test mail, and check if mail() fails to send emails. See what does it return.
 
Hi there zEitEr

I did what you said, but no luck.

For the simple PHP script, thats already done :
Code:
<?php

if(!mail('[email protected]', 'A test subject', 'A test Message.'))
    echo 'No luck sending that e-mal.';

Logs from exim (i think on receving e-mails)
2011-03-20 14:51:40 1Q1Ign-0003bg-8V unable to set gid=12 or uid=525 (euid=8): domain_filter router (recipient is bruno_AT_gabian-herault.com)
2011-03-20 14:51:40 1Q1Ign-0003bg-8V internal problem in domain_filter router (recipient is bruno_AT_gabian-herault.com): failure to transfer data from subprocess: status=0100 readerror='Success'
2011-03-20 14:51:40 1Q1Ign-0003bg-8V == bruno_AT_gabian-herault.com R=domain_filter defer (-1): internal problem in domain_filter router (recipient is bruno_AT_gabian-herault.com): failure to transfer data from subprocess: status=0100 readerror='Success'

Edit
In DA task log (errortaskq.log), i have this :
2011:03:20-12:53:12: Error restarting service httpd : uid 0 gid 0 : /sbin/service httpd restart >>/dev/null 2>>/dev/null
2011:03:20-12:53:22: An error occurred while sending the mail
 
Last edited:
Sky,
What are the permissions on /usr/sbin/exim? They should be:
Code:
-rwsr-xr-x 1 root root 911962 Dec 10 08:36 /usr/sbin/exim
Note the 's' instead of 'x' in the owner field. You should be able to get those permissions by doing:
Code:
chown root:root /usr/sbin/exim
chmod 4755 /usr/sbin/exim
/etc/init.d/exim restart
This should change the permissions to exim to allow it to become another user/group. If it doesn't have these permissions, then it will only be able to access files that are owned by the userid that started exim. If this doesn't help, then perhaps if we knew which OS you were on and posting your exim.conf/httpd.conf/php.ini files we would be able to piece together what is going wrong.
 
That whas the problem !
Thx, i dont know how the perms for exim bin got changed !

Thx again !!!
 
bug in set_permissions.sh on Centos 5.7

The set_permissions.sh script was responsible for it. My /usr/sbin/exim was -rwsr-xr-x, but this was the result of running
/usr/local/directadmin/scripts/set_permissions.sh email
Code:
<snip, snip>
set /var/log/exim mail:mail 640 flag -R
set /var/log/exim mail:mail 750 flag
set /usr/sbin/exim root:root 4755 flag
-bash-3.2# ls -la /usr/sbin/exim
-rwxr-xr-x 1 root root 1056574 Apr 30  2011 /usr/sbin/exim

I added 'echo chmod $5 $4 $1' to set_file() in set_permissions.sh. To my surprise the chmod was executed correctly as

chmod 4755 /usr/sbin/exim

But apparently without success:
Code:
set /var/log/exim mail:mail 750 flag
chmod 750 /var/log/exim
set /usr/sbin/exim root:root 4755 flag
chmod 4755 /usr/sbin/exim
-bash-3.2# ls -la /usr/sbin/exim
-rwxr-xr-x 1 root root 1056574 Apr 30  2011 /usr/sbin/exim

After some debugging I found out what was wrong. The chown root:root command changes the permissions from 4755 into 755!

Code:
-bash-3.2# chmod 4755 /usr/sbin/exim
-bash-3.2# ls -la /usr/sbin/exim
-rwsr-xr-x 1 root root 1056574 Apr 30  2011 /usr/sbin/exim
-bash-3.2# chown root:root /usr/sbin/exim
-bash-3.2# ls -la /usr/sbin/exim
-rwxr-xr-x 1 root root 1056574 Apr 30  2011 /usr/sbin/exim

Solution: the chmod and chown commands in set_permissions.sh should be executed in reverse order.

CentOS release 5.7 (Final)
 
Last edited:
You should update Directadmin, as it was already fixed:

Code:
# grep /usr/sbin/exim set_permissions.sh
        set_file /usr/sbin/exim root $RT_GRP 4755


and

Code:
# grep 'set_file(' set_permissions.sh --after=20
set_file()
{
        if [ -e "$1" ] || [ "$6" = "nocheck" ]; then
                log "set $1 $2:$3 $4 flag $5";

                #chown goes first.
                #A 4755 file is set to 755 if chown is called after chmod.

                chown $5 $2:$3 $1
                chmod $5 $4 $1
        fi

}
 
/usr/local/directadmin/custombuild/build update_da tells me:

-bash-3.2# /usr/local/directadmin/custombuild/build update_da
Updating DirectAdmin
-bash-3.2#

And nothing else. After this

/usr/local/directadmin/custombuild/build all (or apache)

fails during the make of Apache 2.2.17.

/usr/local/directadmin/custombuild/build update_versions

also answers with 'Updating DirectAdmin' and nothing else.

Even stranger is this

Code:
-bash-3.2# /usr/local/directadmin/custombuild/build versions
Latest version of DirectAdmin: 1.38.3
Installed version of DirectAdmin: 1.40.3

DirectAdmin 1.40.3 to 1.38.3 update is available.

That is no update, it is a 'downdate'.
 
Every Directadmin update.tar.gz contains a script directory with actual copies of the scripts. Your copies seems to be too old.
 
Back
Top