Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using apache, php and sendmail. I can send mail from command line with sendmail.

However, in php file, mail function is not working.

Then, I run that php email test file from command line. It works.

#>php mail_test.php

I thought it is apache issue and I changed httpd_can_sendmail on. But it is still not working. I checked sendmail permission and it is 666.

I checked httpd error log and I found this:

sh: /usr/sbin/sendmail: Permission denied.

I don't know where to change permission anymore.

share|improve this question
What is the user:group of php/apache ? – Lucas Jan 27 '12 at 10:22
The permission cannot be 666, for then the sendmail binary is not executable. – adamo Jan 27 '12 at 11:16
yes 777 now but not working yet Thanks . Error must be somewhere else – kingzuphur Jan 27 '12 at 11:45
What do logs say now? – symcbean Jan 27 '12 at 11:47
Still the error log [Fri Jan 27 06:25:23 2012] [notice] SELinux policy enabled; httpd running as context unconfined_u:system_r:httpd_t:s0 [Fri Jan 27 06:25:23 2012] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec) [Fri Jan 27 06:25:28 2012] [notice] Digest: generating secret for digest authentication . [Fri Jan 27 06:25:28 2012] [notice] Digest: done [Fri Jan 27 06:25:29 2012] [notice] Apache/2.2.15 (Unix) DAV/2 PHP/5.3.3 mod_ssl/2.2.15 OpenSSL/1.0.0-fips SVN/1.6.11 mod_perl/2.0.4 Perl/v5.10.1 configured -- resuming normal operations sh: /usr/sbin/sendmail: Permission denied – kingzuphur Jan 27 '12 at 11:57

This thread (look at the bottom) suggests that it may be a problem with SELinux permissions. Do you have SELinux enabled?

share|improve this answer
Thanks ,It was. Now I changed it to SELinux disabled . But Still no luck. – kingzuphur Jan 27 '12 at 11:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.