I have asked this question before but with not much success. I guess i was confused and did not put my question properly. So here it goes again.
Some points before i begin:
- I am running FC 14
- I did not install apache manually ... used yum
- safe mode in PHP is turned OFF
Basically I want to execute ping command and show the results on the PHP page. The code I use is
<?php $who = shell_exec('whoami'); $result1 = shell_exec("/webserver_commands/ping -c 4 www.google.com"); exec("ping -c 4 www.google.com",$result2); echo $who; echo "<br/>".$result1; echo "<br/>".$result2; ?>
The Output I get is
So I know the scripts are being run as the user 'apache'
In the apache log I see the following lines
sh: /webserver_commands/ping: Permission denied ping: icmp open socket: Permission denied
I have made sure the directory /webserver_commands/ and the file ping in it are owned by the user apache of the group apache
917506 drwxrwxrwx. 2 apache apache 4096 Feb 4 18:29 webserver_commands 917507 -rwxrwxrwx. 1 apache apache 43448 Feb 4 18:29 ping
Any ideas what could be going wrong here ?
thank you, -ankit