exec() problem with unix
Posted: Tue Mar 28, 2006 5:57 am
hi guys,
hopefully someone here can help.. I have trawled every forum and googled for a week now, and still cant get this fixed..
I have CentOS4.2 installed, with apache2 and php4 rpm installs. httpd is running under user apache.
it appears to work ok.. however.. my problem...
DocumentRoot is set to /var/www/html
my php page is this r.php
<?
shell_exec("/tmp/ls.sh");
?>
/tmp/ls.sh consists of:
#!/bin/sh
ls -al > /tmp/output
when I load sr.php in a browser, nothing happens. ( I am not expecting anything on screen, but /tmp/output never gets created).
a tail of /var/log/http/error_log shows
sh: /tmp/ls.sh: Permission denied
now, /tmp has 777 perms, and if I run
su -c "/tmp/ls.sh" apache
the file /tmp/output gets created.
if I change sr.php to
<?
shell_exec("ls > /tmp/output");
?>
the file /tmp/output gets created!
Any ideas as to why I can not run user scripts from within PHP??
This has got me utterly beaten..
Thanks in advance
hopefully someone here can help.. I have trawled every forum and googled for a week now, and still cant get this fixed..
I have CentOS4.2 installed, with apache2 and php4 rpm installs. httpd is running under user apache.
it appears to work ok.. however.. my problem...
DocumentRoot is set to /var/www/html
my php page is this r.php
<?
shell_exec("/tmp/ls.sh");
?>
/tmp/ls.sh consists of:
#!/bin/sh
ls -al > /tmp/output
when I load sr.php in a browser, nothing happens. ( I am not expecting anything on screen, but /tmp/output never gets created).
a tail of /var/log/http/error_log shows
sh: /tmp/ls.sh: Permission denied
now, /tmp has 777 perms, and if I run
su -c "/tmp/ls.sh" apache
the file /tmp/output gets created.
if I change sr.php to
<?
shell_exec("ls > /tmp/output");
?>
the file /tmp/output gets created!
Any ideas as to why I can not run user scripts from within PHP??
This has got me utterly beaten..
Thanks in advance