Req #26566 [Opn->Ana]: Why does EXEC() have to use CMD.EXE
| From: | kalle@php.net | Date: | Sat, 13 Jun 2015 06:54:07 +0000 |
| Subject: | Req #26566 [Opn->Ana]: Why does EXEC() have to use CMD.EXE | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-193386@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=26566&edit=1
ID: 26566
Updated by: kalle@php.net
Reported by: taomyn at hotmail dot com
Summary: Why does EXEC() have to use CMD.EXE
-Status: Open
+Status: Analyzed
Type: Feature/Change Request
Package: *General Issues
Operating System: Windows
-PHP Version: 7.0
+PHP Version: *
Block user comment: N
Private report: N
New Comment:
Changing this to any version, as the BC break should be low enough to be allowed to be introduced in
a x.z release
Previous Comments:
------------------------------------------------------------------------
[2015-01-01 16:51:07] tyrael@php.net
we already have bypass_shell for proc_open, we could do something similar for exec (or just document
this better and advise people on windows to use proc_open if they don't want the additional
cmd.exe to be executed).
------------------------------------------------------------------------
[2003-12-10 03:13:58] taomyn at hotmail dot com
Perhaps you could create a new function, or even add an extra optional boolean parameter to EXEC()
that would when "true" would not use CMD.EXE?
E.g.
$no_cmd = true;
EXEC("c:\\winnt\\notepad.exe", $result, $status, $no_cmd);
This wouldn't break old code?
------------------------------------------------------------------------
[2003-12-09 16:50:48] wez@php.net
Because we use it as the shell to launch not only external processes, but built-in commands such as
dir that are not found in separate binaries.
I can see the use, but can't see how to implement it without breaking backwards compatibility.
------------------------------------------------------------------------
[2003-12-09 16:34:56] taomyn at hotmail dot com
Description:
------------
Why does EXEC() have to spawn an extra CMD.EXE when executing a program?
For example, to execute NOTEPAD.EXE, WORDPAD.EXE, even ImageMagicks CONVERT.EXE, when called with
EXEC() causes a CMD.EXE process to executed which then calls the program requested. It's not
needed.
Please can we have a version of EXEC that does not use CMD.EXE?
It's not always needed and can cause major issues such as hanging sessions and hanging web
services. A prime example are users of Gallery by http://gallery.menalto.com - many of their Windows users have
this issue which is why they do not "officially" support Windows when it should work.
Thanks,
Taomyn
Reproduce code:
---------------
Call any Windows program with EXEC() and you get a CMD.EXE process that then calls the requested
program.
E.g. exec("c:\\winnt\\notepad.exe",$result,$status);
Expected result:
----------------
Only NOTEPAD.EXE should appear.
Actual result:
--------------
"CMD.EXE /C NOTEPAD.EXE" and "NOTEPAD.EXE" appears in the process list
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=26566&edit=1