ID:               22662
 User updated by:  pjaleysen at hotmail dot com
 Reported By:      pjaleysen at hotmail dot com
-Status:           Feedback
+Status:           Open
 Bug Type:         Program Execution
 Operating System: Windows XP
 PHP Version:      4.2.3
 New Comment:

I have the same problem with php4.3 (at home)


Previous Comments:
------------------------------------------------------------------------

[2003-03-12 17:01:50] [EMAIL PROTECTED]

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.......
//------------------------

------------------------------------------------------------------------

[2003-03-12 11:47:40] [EMAIL PROTECTED]

Sorry, that should be shell_exec('cmd ver');

~ Andrew Heebner

------------------------------------------------------------------------

[2003-03-12 11:45:52] [EMAIL PROTECTED]

How are you passing your params to shell_exec() ?

I know from personal experience, that shell_exec() requires me to load
command.com to the interpreter, such as:

print shell_exec('cmd version');

This *should* print out your windows version...

~ Andrew Heebner

------------------------------------------------------------------------

[2003-03-12 11:33:24] pjaleysen at hotmail dot com

Hi,
shell_exec(),as well as exec(),system(), can only handle 'native' DOS
applications like ping,copy,attrib etc.
either directly as a command, or though a *.bat file.

Executing other (DOS) applications like pkzip (for DOS) or (rar for
dos) don't seem to work.
There is a thread of this issue at www.devshed.com
(http://forums.devshed.com/t55038/s.html)

I am using:
-Windows XP
-Apache 1.3.27
-PHP4.3

All with the default configurations.

Kind regards
Patrick

------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=22662&edit=1

Reply via email to