note 81872 added to ref.exec
| From: | mosesdinakaran at yahoo dot co dot in | Date: | Mon, 17 Mar 2008 14:49:58 +0000 |
| Subject: | note 81872 added to ref.exec | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-137135@lists.php.net to get a copy of this message | ||
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
----
Server IP: 64.71.164.2
Probable Submitter: 59.92.116.157
----
Manual Page -- http://www.php.net/manual/en/ref.exec.php
Edit -- https://master.php.net/note/edit/81872
Del: integrated -- https://master.php.net/note/delete/81872/integrated
Del: useless -- https://master.php.net/note/delete/81872/useless
Del: bad code -- https://master.php.net/note/delete/81872/bad+code
Del: spam -- https://master.php.net/note/delete/81872/spam
Del: non-english -- https://master.php.net/note/delete/81872/non-english
Del: in docs -- https://master.php.net/note/delete/81872/in+docs
Del: other reasons-- https://master.php.net/note/delete/81872
Reject -- https://master.php.net/note/reject/81872
Search -- https://master.php.net/manage/user-notes.php