Cann't exec() or system() with safe_mode=1
| From: | Joaquín | Date: | Wed, 17 Oct 2007 12:59:21 +0000 |
| Subject: | Cann't exec() or system() with safe_mode=1 | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-28570@lists.php.net to get a copy of this message | ||
Hello,
I have a problem with safe_mode. I want to execute some program while in safe_mode=1 but I cann't. To make it as simple as possible I'm now using myprogram.exe that is the typical "hello world" program.
It only works with safe_mode=0 and with safe_mode=1 nothing happens and it returns nothing: no echo, no error message, althoug error_reporting=E_ALL.
I try it with exec() and system() and it is the same (both execute it or both don't).
After having read some blogs and newsgroups I have set all these things:
-myprogram.exe is placed in C:\wwwroot\tests\bin. IUSR_SERV, IWAM_SERV
and ALL can read and execute it.
-a copy of CMD.exe is placed in C:\wwwroot\tests\bin. IUSR_SERV, IWAM_SERV and ALL can read and execute it.
-C:\wwwroot\tests\bin is in the PATH
-safe_mode_exec_dir = "c:\wwwroot\tests\bin"
-with IIS manager I have set both "Anonymous"_and_"Windows integrated" authentication and only "Windows integrated" authentication in C:\wwwroot\tests.
¿Have you any idea?
This is my php
##########################################################
<?php
$retstr = exec('C:\wwwroot\tests\bin\myprogram.exe 2>&1',$retval);
echo "<p>retstr: ".$retstr;
echo "<p>retval: ";
if ((bool)$retval!=False){
foreach ($retval as $nombre => $valor){
echo $valor."<br>";
}
} else {
echo "False<br>";} echo "<hr>"; $retstr = system('C:\wwwroot\tests\bin\myprogram.exe 2>&1',$retval); echo "<p>retstr: ".$retstr; echo "<p>retval: "; if ((bool)$retval!=False){
echo "True<br>";} else {
echo "False<br>";} ?> ########################################################## And this my server: Windows 2000 IIS 5 PHP 4.4.3, ISAPI I have tried it in a W2003, IIS6, PHP 4.4.2 with the sema result :( Thanks for your help.