Exec() denied read on Apache (fedora core 3)
| From: | Zia Syed | Date: | Fri, 24 Dec 2004 12:09:51 +0000 |
| Subject: | Exec() denied read on Apache (fedora core 3) | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-205135@lists.php.net to get a copy of this message | ||
Hi,
I've been trying to execute some system commands and print back the
output on the webpage. I found the following code to do so, however,
it is not working.
<?php
echo exec('whoami');
?>
I get following errors in my /var/log/messages
Dec 24 12:03:34 melville kernel: audit(1103889814.948:0): avc: denied
{ read } for pid=13794 exe=/usr/sbin/httpd name=sh dev=hda2
ino=670441 scontext=root:system_r:httpd_t
tcontext=system_u:object_r:bin_t tclass=lnk_file
Apache server is ran by user apache and the .php file is also owned by
user apache.
Apache is not running in Safe_Mode
safe_mode Off Off
safe_mode_exec_dir /var/www/html/sh /var/www/html/sh
safe_mode_gid Off Off
safe_mode_include_dir /var/www/html /var/www/html
However, i tried to switch on the Safe_Mode but that wasn't any good either.
Any idea how can i get it work?
Thanks,
Zia