#22662 [Opn]: shell_exec not working on windows XP
| From: | hholzgra@php.net | Date: | Thu, 13 Mar 2003 12:25:58 +0000 |
| Subject: | #22662 [Opn]: shell_exec not working on windows XP | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-35501@lists.php.net to get a copy of this message | ||
ID: 22662
Updated by: hholzgra@php.net
Reported By: pjaleysen at hotmail dot com
Status: Open
Bug Type: Program Execution
Operating System: Windows XP
PHP Version: 4.3.0
New Comment:
%PATH% issue? (blind guess)
Previous Comments:
------------------------------------------------------------------------
[2003-03-13 03:01:51] pjaleysen at hotmail dot com
HI, I tried it out with PHP Version 4.3.2-RC but the problem remains;
native MS-DOS commands work fine, other DOS-applications do not
respond.
kind regards
Patrick
------------------------------------------------------------------------
[2003-03-12 17:05:51] sniper@php.net
Yes, but the snapshot is 4.3.2-dev so try it out.
We're about to release 4.3.2 soon.
------------------------------------------------------------------------
[2003-03-12 17:04:09] pjaleysen at hotmail dot com
I have the same problem with php4.3 (at home)
------------------------------------------------------------------------
[2003-03-12 17:01:50] sniper@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php4-STABLE-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php4-win32-STABLE-latest.zip
4.2.3 is way too old.
------------------------------------------------------------------------
[2003-03-12 11:58:58] pjaleysen at hotmail dot com
like I said, the native Windows commands work correctly. I tried
putting cmd before a command, but invain.
This is a brief summary of the forum thread, found at
http://forums.devshed.com/t55038/s.html):
//---------------------------------------------------
I am trying to use pkzip to compress documents.
I am running a windows PC, so I am trying to execute a DOS command.
I have so far:
<?php
$pkzip="C:/Progra~1/Apache~1/Apache/readwr~1/pkzip.exe";
$pkzipdirectory="C:/Progra~1/Apache~1/Apache/readwr~1/";
$command=$pkzip." ".$pkzipdirectory."myzip.zip"."
".$pkzipdirectory."mydoc.doc";
shell_exec($command);
?>
It doesnt work
//---------------------------------------------------------
shouldn't have to as long as cmd.exe is in your path.
can't believe its not really.
maybe try a little test like this and see what you get back,
then you'll know if its a path problem.....
<?php
$test = shell_exec("ping 192.168.0.1");
echo $test;
?>
//------------------------------------------------------
The ping works ok!
I can do the standard commands alright.
I tried:
1)using absolute directories (like above)
2) changing path=, to include the pkzip file (A dos version of pkzip)
3) changing to the 'long' directory notation (e.g progra~1 => program
files)
//-------------------------------------------------
Executing commands in the shell from a PHP script only works
when the program you are trying to execute resides in your
system directory (windows 2000: c:\winnt\system32).
//-----------------------------------------
I might have a clue!?!?
e.g. I have a batchfile saying:
"echo this batchfile works"
running this with:
<?php
$test=shell_exec("run.bat ");
echo $test;
?>
echoos 'echo this batchfile works'
Shouldnt the 'echo' NOT be there in the echo $test?
It's like it is just reading the line, instead of executing it.......
//------------------------
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/22662
--
Edit this bug report at http://bugs.php.net/?id=22662&edit=1