|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits              [2007-04-29 15:04 UTC] sniper@php.net
  [2007-04-29 16:58 UTC] boen dot robot at gmail dot com
 | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 11:00:01 2025 UTC | 
Description: ------------ When executing a command with system(), exec(), passthru() or shell_exec(), quotes in the program's path are not accepted and nothing is returned (except error code 1). The same command with quotes around the path works from the command line. Without quotes, the program only works if there are no spaces in the paths, which is where the real problem lies. Reproduce code: --------------- <?php ini_set('display_errors','On'); ini_set('error_reporting',1); print system('"D:\vasko\Software\XSLT2\saxonsa8-8n\bin\transform.exe" -a "D:\htdocs\XML\_benchmark\reference.xml"',$status); print $status; ?> Returns 1 (because of the "print $status" - otherwise it's an empty default HTML). <?php ini_set('display_errors','On'); ini_set('error_reporting',1); print system('D:\vasko\Software\XSLT2\saxonsa8-8n\bin\transform.exe -a "D:\htdocs\XML\_benchmark\reference.xml"',$status); print $status; ?> Returns the output of the program, and 0 after it. This particular case works, but if the path had spaces, there would be no way to execute the program... not withing PHP anyway (a bat file could be a solution, but still...). Expected result: ---------------- The program should run even if the path to it has quotes and it's output should be then printed. Actual result: -------------- The first code, when executed results in an error, which wouldn't be raised with the same command executed directly from the command line.