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

We moved from Slackware to CentOS here, it was working fine then without notice, php stopped executing external calls such as calls to "wc" and "spamc". All such calls appear on error_log as:

sh: /usr/bin/spamc: Permission denied

The paths are correct. We have the permissions set correctly and apache is supposed to be able to execute the files with no problem. We're NOT on safe_mode and we do not have base_dir set. It is not SELinux, or at least sestatus says SELinux is disabled.


  • PHP can't execute anything thru exec() or popen()
  • Paths to binaries are correct.
  • We are not in safe mode
  • We don't have base_dir set
  • Permissions on the binaries allow apache user to execute them
  • SELinux is disabled
  • on php.ini the disable_functions is empty
  • We have no clue why it doesn't work

PHP version 5.3.3 and CentOS 5.5

Anyone has a clue of what might be happening? Thanks in advance

share|improve this question
up vote 1 down vote accepted

Found the error.

I was trying to execute /usr/bin/tidy for example, the usr folder had a 644 permission which is akin to lovecraftian horror in my book. I could work because I was root.

I figured it out after going crazy and deciding to check the permissions on all the path components of the command from the root / folder to the tidy binary, I found all permissions set correctly but the usr folder perms were completely screwed.

This is fixed.

share|improve this answer

Permissions ?

This hits of permissions... keep in mind

"Permission denied" can be anywhere along the path and not just the file your calling itself. So look at "/usr /usr/bin" and "/" as well.


This could also be due to php not having something compiled it wants. Can you turn strace on and try it again ?

to do this - you will need to stop/start apache / exim (or whatever) w/ strace turned on:

strace -f -o trace.txt /etc/rc.d/init.d/servicename  start

Generally this is apache btw

strace -f -o trace.txt /etc/rc.d/init.d/httpd start Now simply try to run the function again

Since the "-o" option saves the result to "trace.txt" file let's go ahead and peek @ that file:

cat trace.txt | grep "/usr/bin/spamc"

That should allow you see a much better log and a hint to what is happening

Make sure you turn that strace off - or the logs will become very large

share|improve this answer
thanks for the reply, I see this: -1 EACCES (Permission denied) any clue? – Andre Garzia Dec 1 '10 at 19:01

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.