#35961 [NEW]: executing programs with spaces in program name and parameters fails.

From: Date: Tue, 10 Jan 2006 11:58:43 +0000
Subject: #35961 [NEW]: executing programs with spaces in program name and parameters fails.
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-91729@lists.php.net to get a copy of this message
From: rquadling at gmail dot com Operating system: Windows XP SP2 PHP version: 5.1.1 PHP Bug Type: CGI related Bug description: executing programs with spaces in program name and parameters fails. Description: ------------ Within windows CMD32, the following works (obviously you will need to have a Windows system with Internet Explorer installed). "C:\Program Files\Internet Explorer\IEXPLORE.EXE" Will load Internet Explorer. In PHP run from the CLI ... <?php $sOutput = shell_exec('"C:\Program Files\Internet Explorer\IEXPLORE.EXE"'); ?> Will load Internet Explorer and wait until it is closed. If you want to pass the program a parameter then you would wrap the parameter with double quotes. e.g. From the command line ... "C:\Program Files\Internet Explorer\IEXPLORE.EXE" "http://www.google.com" Will load Internet Explorer and place you at Google. If you try the same sort of thing in PHP ... <?php $sOutput = shell_exec('"C:\Program Files\Internet Explorer\IEXPLORE.EXE" "http://www.google.com"'); ?> You get an error of ... 'C:\Program' is not recognized as an internal or external command, operable program or batch file. Reproduce code: --------------- <?php $sOutput = shell_exec('"C:\Program Files\Internet Explorer\IEXPLORE.EXE" "http://www.google.com"'); ?> Expected result: ---------------- Internet Explorer loads with the Google page being displayed. Actual result: -------------- 'C:\Program' is not recognized as an internal or external command, operable program or batch file. -- Edit bug report at http://bugs.php.net/?id=35961&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=35961&r=trysnapshot44 Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=35961&r=trysnapshot51 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=35961&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=35961&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=35961&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=35961&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=35961&r=needscript Try newer version: http://bugs.php.net/fix.php?id=35961&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=35961&r=support Expected behavior: http://bugs.php.net/fix.php?id=35961&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=35961&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=35961&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=35961&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=35961&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=35961&r=dst IIS Stability: http://bugs.php.net/fix.php?id=35961&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=35961&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=35961&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=35961&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=35961&r=mysqlcfg

« previous php.bugs (#91729) next »