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

From: Date: Tue, 10 Jan 2006 13:00:14 +0000
Subject: #35961 [Bgs]: executing programs with spaces in program name and parameters fails.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-91731@lists.php.net to get a copy of this message
ID: 35961 User updated by: rquadling at gmail dot com Reported By: rquadling at gmail dot com Status: Bogus Bug Type: CGI related Operating System: Windows XP SP2 PHP Version: 5.1.1 New Comment: Well, doesn't that just suck! Previous Comments: ------------------------------------------------------------------------ [2006-01-10 13:49:41] tony2001@php.net Not PHP problem. See bug #25361. ------------------------------------------------------------------------ [2006-01-10 12:58:41] rquadling at gmail dot com 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 this bug report at http://bugs.php.net/?id=35961&edit=1

« previous php.bugs (#91731) next »