php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #16542 safe_mode_exec_dir and exec()
Submitted: 2002-04-11 04:08 UTC Modified: 2002-11-26 19:59 UTC
Votes:4
Avg. Score:4.0 ± 0.7
Reproduced:3 of 4 (75.0%)
Same Version:2 (66.7%)
Same OS:2 (66.7%)
From: n dot dose at leo-media dot de Assigned:
Status: No Feedback Package: IIS related
PHP Version: 4.1.2 OS: windows XP
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: n dot dose at leo-media dot de
New email:
PHP Version: OS:

 

 [2002-04-11 04:08 UTC] n dot dose at leo-media dot de
ISAPI mode.  IIS 5.1 

safe_mode_exec_dir = C:\\Inetpub\cgi-bin\

Calls to exec system with {safe mode = On} result in an extra "/" being prepended to the executable file's name:

Warning: Unable to fork [C:\\\\Inetpub\cgi-bin\\/myprog.exe] in c:\inetpub\wwwroot\index.php4

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-04-11 04:17 UTC] n dot dose at leo-media dot de
ISAPI mode.  IIS 5.1 

safe_mode_exec_dir = C:\\Inetpub\cgi-bin\

<?php
exec("myprog.exe");
?>

Calls to exec system with {safe mode = On} result in an extra "/" being
prepended to the executable file's name:

Warning: Unable to fork [C:\\\\Inetpub\cgi-bin\\/myprog.exe] in
c:\inetpub\wwwroot\index.php4


(the fork error results from other issues, but notice the /myprog.exe)
 [2002-04-11 06:19 UTC] sander@php.net
YOu're messing with backslashes and slashes. Try setting the safe_mode_exec_dir to something like c:/inetpub/cgi-bin
Does it work now?
 [2002-05-12 00:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a month, 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".
 [2002-05-13 06:36 UTC] sander@php.net
Reopening on user request: it doesn't work, even with forward slashes 
 [2002-11-03 11:05 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-15 22:02 UTC] justinNOSPAMclarke at xcelco dot on dot ca
I am running Win2K with PHP 4.2.1 and I am experiencing this same type of problem. Hopefully I can provide a little more feedback.

safe_mode = On
safe_mode_exec_dir = "D:\web\test\"

Here's what I've got. I've tried with frontslashes no trailing slash, you name it, I've tried it. No exec() or system(), etc. statement will work from this directory (or any other directory for that matter while safe_mode is on).

If I take off safe_mode, everything is fine (obviously).

I can provide more info if necessary. Please feel free to e-mail.
 [2002-11-15 22:03 UTC] justinNOSPAMclarke at xcelco dot on dot ca
By the way, this is being used as a module for Apache.
 [2002-11-15 22:07 UTC] rasmus@php.net
Just curious, are you guys really running a shared server on Windows?  Because safe_mode makes very little sense in a non-shared environment.
 [2002-11-15 22:16 UTC] justinNOSPAMclarke at xcelco dot on dot ca
My host is running safe mode, and so I need to figure out how to tell them to give my directory access to exec()

I would rather not run safe_mode at all.
 [2002-11-26 19:59 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 [2004-04-24 22:22 UTC] andy_jcs at yahoo dot ca
Same problem, tested on Win2K and Win XP.
 [2006-06-14 14:47 UTC] thunderbug66 at gmail dot com
was having the same problem.  found that you have to use the entire path to you executable:
safe_mode_exec_dir = "C:\php\exec"

<?php
exec("C:\php\exec\myprog.exe");
?>

works for me CLI
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Oct 24 01:03:33 2021 UTC