mail() function in PHP fails after qmail install on RHEL

Posted: October 7, 2009 in Technical

I just set up a server of ours with qmail, using the qmail-toaster install. Everything works great. Pop accounts and imap, and receiving and sending mail works. However, I have two problems, and I’m wondering if they may be interrelated. The first is the big one1. when using the mail() function within php, via apache, the mail function fails. As we all know, there’s no error info from the php script, so I’m confused. However, the script, when executed via any user, on the command line “php mail.php” works great sending the mail. However, the same script does not work via apache. I’m SO lost about this, and my php apps are unable to send mail. I’ve checked permissions in every way I can think of, and set all associated items to 777 just to make sure it’s not a permissions problem. No difference. I also don’t see any errors in the qmail-send current log. And yes, all qmail processes are running. as far as I can see:

[root@www1 httpd]# qmailctl statauthlib: up (pid 28416) 995 secondsclamd: up (pid 29506) 0 secondsimap4: up (pid 28391) 995 secondsimap4-ssl: up (pid 28389) 995 secondspop3: up (pid 28399) 995 secondspop3-ssl: up (pid 28441) 995 secondssend: up (pid 28392) 995 secondssmtp: up (pid 28409) 995 secondsspamd: up (pid 28440) 995 secondssubmission: up (pid 28388) 995 secondsauthlib/log: up (pid 28426) 995 secondsclamd/log: up (pid 28429) 995 secondsimap4/log: up (pid 28403) 995 secondsimap4-ssl/log: up (pid 28405) 995 secondspop3/log: up (pid 28400) 995 secondspop3-ssl/log: up (pid 28390) 995 secondssend/log: up (pid 28408) 995 secondssmtp/log: up (pid 28395) 995 secondsspamd/log: up (pid 28404) 995 secondssubmission/log: up (pid 28428) 995 seconds[root@www1 httpd]#

2. When attempting to use qmailadmin via apache, I get this error in the apache logs:Quote:

[Mon Oct 05 17:31:18 2009] [error] [client x.x.x.x] (13)Permission denied: exec of ‘/usr/share/qmailadmin/index.cgi’ failed[Mon Oct 05 17:31:18 2009] [error] [client x.x.x.x] Premature end of script headers: index.cgi

Even though apache is running as the apache user, and that user does have proper permission to the qmailadmin/index.cgi link.Running RHEL 5 x86_64The Solution? Well, it seems as if I had SELinux enforcing, which was causing all of my issues. After I disabled it, everything started working just fine. Crazy.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s