php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #14897 "unable to fork" - cause & solution (well, at least for me)
Submitted: 2002-01-06 22:00 UTC Modified: 2002-11-16 01:00 UTC
Votes:31
Avg. Score:4.8 ± 0.6
Reproduced:26 of 26 (100.0%)
Same Version:10 (38.5%)
Same OS:14 (53.8%)
From: louis at steelbytes dot com Assigned:
Status: No Feedback Package: Program Execution
PHP Version: 4.1.1 OS: Windows 2000
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2002-01-06 22:00 UTC] louis at steelbytes dot com
in 4.0.6, popen() would just call CreateProcess() with the specified command.

this was ok.

in 4.1.0 popen() now prepends "cmd.exe /c " (or "command.com /c " on win9x).

the problem with this, is that many web admins will disable access for the web apps to access cmd.exe (eg, MS's IISLockDown does this), and hence even though the web app may have access to c:\utils\myapp.exe, a command like exec("c:\utils\myapp.exe") now fails on 4.1.0 but works on on 4.0.6.

also, the hardcoding of cmd.exe should not be done.  it should get it from the enviroment.

summary:

have commands that prepend the result of an enviroment lookup on "%comspec% /c " to the front of a command

AND

have commands that dont, so that I can call exec("c:\utils\myapp.exe");  without having to enable access to cmd.exe

OR

any interpretation of these issues, that allow for a sensible amount of flexibilty.

Louis Solomon
www.SteelBytes.com


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-01-17 05:56 UTC] davidfelton at codemasters dot com
clarification: is this a suggestion of a way to fix the problem myself (so I can call programs), or a suggestion to the developers?
 [2002-01-17 19:40 UTC] louis at steelbytes dot com
this is a suggestion to the developers to do, because the only way for a script writer to solve this is to enabled access to cmd.exe which many would perfer to not have to do.
 [2002-01-21 06:32 UTC] davidfelton at codemasters dot com
Is there a way to enable access to cmd.exe so that it is only available to php.exe?
Or a way of stopping php prepending "cmd.exe /c " in front of any calls to exec?

thanks.
 [2002-01-21 07:16 UTC] louis at steelbytes dot com
re enable access to cmd.exe for php:

if you are using IIS, then PHP will be run using the IWAM_<machinename> account. so you would have to set the right for cmd.exe to include this account.

if you are using a different web server, then I have no idea what account would need access to cmd.exe

re stopping php from prepending "cmd /c ":

not that I know of, and hence the bug report that I posted requesting the developers changing it.
 [2002-10-31 14:51 UTC] iliaa@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-latest.zip


 [2002-11-16 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over 2 weeks, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2004-07-30 08:01 UTC] kaushy1 at yahoo dot com
i encoutered the same problem in ty to solve it 
i used IIS server with win XP 
as in the bottem of the page i try to download the file in link in http://snaps.php.net/win32/php4-win32-latest.zip 
but it gives the following error
"Forbidden
You don't have permission to access /win32/php4-win32-latest.zip on this server."

pls make the error correct
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sat Sep 25 21:03:35 2021 UTC