Hi
I had problem with executing exec(),shell_exec() (PHP is not running on Safe Mode).
After spending some time I was able to find out that the Problem is with SELinux enabled in my system.
You can make sure about this by seeing the log /var/log/messages
So I disabled SELinux and now everything works.
A Temporary Disable to selinux #> setenforce 0;
Since I felt this is not a good Idea I still went through some sites and find a solution which I felt good.
Fedora's SELinux policy has some booleans - let's see what it has for our apache:
# /usr/sbin/getsebool -a | grep httpd
allow_httpd_anon_write -- off
allow_httpd_mod_auth_pam -- off
allow_httpd_sys_script_anon_write -- off
httpd_builtin_scripting -- on
httpd_can_network_connect -- off
httpd_can_network_connect_db -- off
httpd_can_network_relay -- off
httpd_disable_trans -- off
httpd_enable_cgi -- on
httpd_enable_ftp_server -- off
httpd_enable_homedirs -- on
httpd_rotatelogs_disable_trans -- off
httpd_ssi_exec --off
httpd_suexec_disable_trans -- off
httpd_tty_comm -- off
httpd_unified -- on
From the above we can make sure that exec() is not working because of this httpd_ssi_exec -- off setting
So I turned it On.
#> setsebool -P httpd_ssi_exec 1;
Now I was able to see the output of shell_exec('ls -al')
Moses