LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   exec command not working (https://www.linuxquestions.org/questions/linux-software-2/exec-command-not-working-453384/)

suruchi 06-10-2006 04:14 AM

exec command not working
 
i tried to run exec, system command with php script but not working
not able to find out any reason

/// test.php
<?

echo exec('whoami');
echo shell_exec('whoami');
echo system('whoami');
?>

but no results when tried from browser to run this file


but when i tried to run this php from prompt it works perfectly
php test.php


i could'nt find reason y this is happening


please put ur thoughts

btmiller 06-10-2006 11:11 PM

Probably PHP safe mode is enabled. Safe mode will prevent PHP, as invoked from Apache, from executing any executables except in precepicief directories (see the safe_mode_exec_dir parameter in your php.ini to see what this is set to). Believe me, safe mode is a good thing that helps prevent people from exploiting buggy PHP scripts to exploit your system (it's not perfect, or anywhere close, but it helps).

suruchi 06-12-2006 01:02 AM

exec not working
 
Quote:

Originally Posted by btmiller
Probably PHP safe mode is enabled. Safe mode will prevent PHP, as invoked from Apache, from executing any executables except in precepicief directories (see the safe_mode_exec_dir parameter in your php.ini to see what this is set to). Believe me, safe mode is a good thing that helps prevent people from exploiting buggy PHP scripts to exploit your system (it's not perfect, or anywhere close, but it helps).



i set safe_mode_exec_dir variable to "On" in php.ini but still not working


All times are GMT -5. The time now is 11:27 PM.