php exec() function in chrooted apache
Hi,
I have two apache servers installed in the same computer, one is chrooted and the other isn't.
So far the chrooted apache is working well, but I can't use exec() to copy some files I need.
This code run from the non-chrooted apache
<?php
$com="/chroot/bin/cp /chroot/usr/local/apache2/htdocs/file1 /chroot/usr/local/apache2/htdocs/file2;
exec($com,$res,$a);
echo $a;
?>
exits with error code 0 and the file is copied
This code run from whithin the chrooted apache
<?php
$com="/bin/cp /usr/local/apache2/htdocs/file1 /usr/local/apache2/htdocs/file2;
exec($com,$res,$a);
echo $a;
?>
always exits with error code 127 (command not found)
command used to run the chrooted apache:
/usr/sbin/chroot /chroot/ /usr/local/apache2/bin/httpd -k start
inside the /chroot directory I have copied everything needed
in /chroot/etc/passwd I have only one user: nobody, with shell /bin/bash
in /chroot/etc/bin I have copied /bin/bash and /bin/cp
I have copied also the libraries cp needed in /chroot/lib
php.ini is the same for both apaches, and safe_mode is off.
Please help!
|