Hello,
My problem is :
Why Program Execution Functions do not work correctly ?
I attempt to run exec(),system(),shell_exec(),passthru()
but these functions do not work correctly although I use from filtering functions such as escapeshellarg() and escapeshellcmd() !!!
for example shell_exec('ls /') work correctly BUT shell_exec('ls /mnt') do not work !
Please help to me.
Thanks alot.
O.R.B
Why Program Execution Functions do not work correctly ?
Moderator: General Moderators
Thanks about your answer BUT...
-------------------------------------------------------------------------------------------feyd wrote:usually it's a permissions problem.
Hello,
Why the command exec( " ls / " ) works correctly but exec( " ls /mnt " ) or exec( " mkdir /newDir " ) or ... do not works ?
and for example : Why the return of system( " sendsms $telNum $msg " ) is 127 ? what is mean 127 ???
since I am in root I think it is not a permissions problem.
Thanks again.
- AKA Panama Jack
- Forum Regular
- Posts: 878
- Joined: Mon Nov 14, 2005 4:21 pm
You might want to read up on it...
http://us2.php.net/manual/en/ref.exec.php
The server can LIMIT what directories and executables you have access. You probably do not have permission to access those directories. Also, if the server has SELinux enabled then accessing files and executables is SEVERELY restricted. Safe Mode also adds access restrictions as well.
In many cases PHP is limited to accessing directories in the webroot. This is especially true on servers offering virtual hosting. Most do not like anyone having access to executables via PHP and block most of it.
http://us2.php.net/manual/en/ref.exec.php
The server can LIMIT what directories and executables you have access. You probably do not have permission to access those directories. Also, if the server has SELinux enabled then accessing files and executables is SEVERELY restricted. Safe Mode also adds access restrictions as well.
In many cases PHP is limited to accessing directories in the webroot. This is especially true on servers offering virtual hosting. Most do not like anyone having access to executables via PHP and block most of it.