|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2002-08-30 13:51 UTC] iliaa@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 08:00:01 2025 UTC |
Problem: When the command line passed to passthru contains more than one argument that is quoted, the command line is not run. For example: passthru("\"C:\\Some dir\\prog.exe\" arg"); -- works passthru("\"C:\\Some dir\\prog.exe\" \"new arg\""); --fails Systems tested: Windows NT 4.0 and Windows 2000 Apache 1.3.22 with php4apache.dll PHP versions 4.1 and 4.1.1 (problem not present w/ 4.06) PHP and Apache are the distributed Windows binaries safe_mode is off Example script: <html> <head> <title>PHP Test Script</title> </head> <body> <h1>PHP Test Script</h1> <?php function write_example($command) { // Write a header. echo "\n<h2>Command: ", htmlspecialchars($command), "</h2>\n\n<pre>\n"; // Run the command. passthru($command); // Finish up the section. echo "\n</pre>\n"; // Done, return. return false; } write_example("test.bat"); write_example("\"test.bat\""); write_example("\"test.bat\" arg"); write_example("\"test.bat\" \"arg\""); ?> </body> </html> Contents of "test.bat" (goes in same dir as script above): @echo Batch file run OK