Re: system, exec, shell_exec, passthru

From: Date: Mon, 14 Aug 2006 17:48:28 +0000
Subject: Re: system, exec, shell_exec, passthru
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-240646@lists.php.net to get a copy of this message
No, it not on... safe_mode Off Off safe_mode_exec_dir no value no value safe_mode_gid Off Off safe_mode_include_dir no value no value .M Adam Zey wrote:
Michael Jonsson wrote:
Hi, I can run any external program like ls, cp, uptime... But if a try to run my shell script a get error.
         $passwdexe = "sudo /usr/bin/webpasswd";
         $user=$_POST[name];
         $passwd="$passwdexe $user 123456";
         echo $passwd;
         $result = system($passwd);
Resultat from the web, "sudo /usr/sbin/webpasswd billy 12345678" and from the error_log, "couldn't read file "./usr/sbin/webpasswd.": no such file or directory". .Mike
Notice that "." is being appended before the path, which turns it into a relative path. It looks like safe mode might be on. Create a new PHP script with nothing but the command "phpinfo();" in it, and view it in a browser. To see if safe mode is on, look for the setting "safe_mode". The line below it is "safe_mode_exec_dir". If safe mode is on, you'll need to put your program ("webpasswd") into that directory to execute it. Regards, Adam Zey.


« previous php.general (#240646) next »