Home » Centos/RHEL » Apache » sh: whoami/command not found with php exec function.

sh: whoami/command not found with php exec function.

If you are getting error as “sh: whoami/command not found” with php exec function.
You need to check the apache error logs. Because in my case apache logs was showing below error.
[Thu Sep 04 19:41:27 2014] [error] [client xxx.xxx.xxx.xx] sh: whoami: command not found
The problem was the env_path setting in the conf file. So to resolve the problem edit the suphp.conf file and change env_path as below.

#vi /etc/suphp.conf
;PATH environment variable
env_path=/bin:/usr/bin

Change To.

;PATH environment variable
env_path=”/bin:/usr/bin”
and then
#service httpd restart

Then problem was solved.

About

I am founder and webmaster of www.linuxpcfix.com and working as a Sr. Linux Administrator (Expertise on Linux/Unix & Cloud Server) and have been in the industry since more than 14 years.

Leave a Reply

Your email address will not be published. Required fields are marked *

*
*

Time limit is exhausted. Please reload the CAPTCHA.

Categorized Tag Cloud