Re: Cann"t exec() or system() with safe_mode=1
am 17.10.2007 14:56:24 von Stut
Joaquín wrote:
> 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?
Try using forward slashes instead of backslashes.
-Stut
--
http://stut.net/
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Cann"t exec() or system() with safe_mode=1
am 17.10.2007 14:59:21 von javalpi
--------------000307050306050204060700
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit
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
##########################################################
$retstr = exec('C:\wwwroot\tests\bin\myprogram.exe 2>&1',$retval);
echo "
retstr: ".$retstr;
echo "
retval: ";
if ((bool)$retval!=False){
foreach ($retval as $nombre => $valor){
echo $valor."
";
}
} else {
echo "False
";
}
echo "
";
$retstr = system('C:\wwwroot\tests\bin\myprogram.exe 2>&1',$retval);
echo "retstr: ".$retstr;
echo "
retval: ";
if ((bool)$retval!=False){
echo "True
";
} else {
echo "False
";
}
?>
##########################################################
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.
--------------000307050306050204060700
Content-Type: message/rfc822;
name="Cann't exec() or system() with safe_mode=1.eml"
Content-Transfer-Encoding: 8bit
Content-Disposition: inline;
filename="Cann't exec() or system() with safe_mode=1.eml"
X-Mozilla-Keys:
Message-ID: <4715FF67.9010507@gmail.com>
Date: Wed, 17 Oct 2007 14:26:15 +0200
From: =?ISO-8859-1?Q?Joaqu=EDn?=
User-Agent: Thunderbird 2.0.0.6 (Windows/20070728)
MIME-Version: 1.0
To: php-windows-digest@lists.php.net
Subject: Cann't exec() or system() with safe_mode=1
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit
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
##########################################################
$retstr = exec('C:\wwwroot\tests\bin\myprogram.exe 2>&1',$retval);
echo "retstr: ".$retstr;
echo "
retval: ";
if ((bool)$retval!=False){
foreach ($retval as $nombre => $valor){
echo $valor."
";
}
} else {
echo "False
";
}
echo "
";
$retstr = system('C:\wwwroot\tests\bin\myprogram.exe 2>&1',$retval);
echo "retstr: ".$retstr;
echo "
retval: ";
if ((bool)$retval!=False){
echo "True
";
} else {
echo "False
";
}
?>
##########################################################
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.
--------------000307050306050204060700
Content-Type: text/plain; charset=us-ascii
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--------------000307050306050204060700--
Forward slashes don"t work but astonish me
am 18.10.2007 10:08:51 von javalpi
(This is a respond "again" message because I think I made it wrong the
first time: my first respond message isn't in the news since yesterday.)
There is some changes compared to using backslahes but it doesn't work.
Using backslashes
php.ini
safe_mode_exec_dir = "c:\wwwroot\tests\bin"
myphp.php
$retstr = exec('C:\wwwroot\tests\bin\myprogram.exe 2>&1',$retval);
$retstr = system('C:\wwwroot\tests\bin\myprogram.exe 2>&1',$retval);
When safe_mode=0
exec() $retval is "Hello World" and system() $retval is False (although
"Hello World" is displayed).
When safe_mode=1
both $retval are False and there isn't any echo.
Using forward slashes
When safe_mode=0
The same as above.
When safe_mode=1
exec() $retval is False BUT system() $retval is True. There is no echo
anyway :(
So system() $retval is False always when there is echo and sometimes
when there isn't, and is True sometimes when there isn't echo.
Does this make any sense for anyone!?
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
[Fixed] :)
am 22.10.2007 13:36:43 von javalpi
After a lot of tests (some of them with very litle sense, you would
laugh at me but dispair makes that) I have found the answer:
¡¡path with forward slashes AND ended with slash!!.
with or without ", with a single or double // are the same.
safe_mode_exec_dir = c:/wwwroot/tests/bin/
safe_mode_exec_dir = "c:/wwwroot/tests/bin/"
safe_mode_exec_dir = c://wwwroot//tests//bin//
The absolut path in exec() or system() is unnecessary.
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php