php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #30031 win32 safe_mode=on, safe_mode_exec_dir, and exec function
Submitted: 2004-09-08 20:54 UTC Modified: 2004-11-23 10:52 UTC
From: daniel dot gaddis at tlc dot state dot tx dot us Assigned:
Status: Closed Package: Documentation problem
PHP Version: 4.3.9RC2 OS: windows 2000 service pack 4
Private report: No CVE-ID: None
 [2004-09-08 20:54 UTC] daniel dot gaddis at tlc dot state dot tx dot us
Description:
------------
code on a on windows 2000 service pack 4 system using php 4.3.4 command line with safe_mode=on, safe_mode_exec_dir, and exec function works successfully but fails using php 4.3.9RC2 command line. 

I did not test all versions since 4.3.4 but other php command line versions since 4.3.4 also fail. 

As you can see from example below I am using php.ini-dist and overriding with:

-d safe_mode=on 
-d safe_mode_gid=On 
-d safe_mode_exec_dir=c:\winnt\system32\

I also...
cd /d C:\WINNT\system32 

...and then run the command line php from the directory shown below:


Reproduce code:
---------------
C:\WINNT\system32>D:\PHP\php-4.3.9RC2\php -c D:\PHP\php-4.3.9RC2\php.ini-dist -d safe_mode=on -d safe_mode_gid=On -d safe_mode_exec_dir=c:\winnt\system32\ -r "exec('ping 127.0.0.1',$output,$error); var_dump($output); print ('error code returned: ' . $error);"


Expected result:
----------------
array(12) {
  [0]=>
  string(0) ""
  [1]=>
  string(40) "Pinging 127.0.0.1 with 32 bytes of data:"
  [2]=>
  string(0) ""
  [3]=>
  string(48) "Reply from 127.0.0.1: bytes=32 time<10ms TTL=128"
  [4]=>
  string(48) "Reply from 127.0.0.1: bytes=32 time<10ms TTL=128"
  [5]=>
  string(48) "Reply from 127.0.0.1: bytes=32 time<10ms TTL=128"
  [6]=>
  string(48) "Reply from 127.0.0.1: bytes=32 time<10ms TTL=128"
  [7]=>
  string(0) ""
  [8]=>
  string(30) "Ping statistics for 127.0.0.1:"
  [9]=>
  string(56) "    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),"
  [10]=>
  string(46) "Approximate round trip times in milli-seconds:"
  [11]=>
  string(49) "    Minimum = 0ms, Maximum =  0ms, Average =  0ms"
}
error code returned: 0


Actual result:
--------------
array(0) {
}
error code returned: 0

Patches

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-10-15 18:55 UTC] iliaa@php.net
Try changing c:\winnt\system32\  to
c:/winnt/system32
 [2004-10-18 18:01 UTC] daniel dot gaddis at tlc dot state dot tx dot us
That fixed the problem as posted.

However, when I made that change to my real code it still has issues. It looks like I have some more debugging to do.

Thanks for the help!

Daniel
 [2004-10-19 09:06 UTC] derick@php.net
Marking as "bogus" then, as this was not a bug in PHP but a misconfiguration.
 [2004-10-19 17:16 UTC] daniel dot gaddis at tlc dot state dot tx dot us
how about changing this to a document change request instead?

How about adding a comment/example to chapter on Safe Mode where it talks about safe_mode_exec_dir? You could add that if using windows use the following syntax:


safe_mode_exec_dir=c:/winnt/system32/


what about open_basedir? Does it now require the use of / instead of \ 

thanks,
Daniel
 [2004-10-20 21:48 UTC] daniel dot gaddis at tlc dot state dot tx dot us
how about changing this to a document change request instead?

How about adding a comment/example to chapter on Safe Mode where it talks about safe_mode_exec_dir? You could add that if using windows use the following syntax:

safe_mode_exec_dir=c:/winnt/system32/

what about open_basedir? Does windows now require the use of / instead of \ for open_basedir also?

thanks,
Daniel
 [2004-11-23 10:52 UTC] vrana@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.

"You have to use / as directory separator on all environments including Windows."

open_basedir is not so strict, you can use \ on Windows too.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Aug 18 08:01:29 2024 UTC