Doc #28497 [Com]: Disabling allow_url_fopen via httpd.conf has no effect
| From: | php dot net at site dot lanzz dot org | Date: | Wed, 13 Oct 2010 11:49:29 +0000 |
| Subject: | Doc #28497 [Com]: Disabling allow_url_fopen via httpd.conf has no effect | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-5204@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=28497&edit=1
ID: 28497
Comment by: php dot net at site dot lanzz dot org
Reported by: iwonderiftheyllpostthistoapublicnewsgrou
Summary: Disabling allow_url_fopen via httpd.conf has no
effect
Status: Closed
Type: Documentation Problem
Package: Documentation problem
Operating System: Linux
PHP Version: 4.3.6
Block user comment: N
New Comment:
At this moment, more than six years after this bug was closed, the
documentation
still lists allow_url_fopen as being PHP_INI_ALL.
http://php.net/manual/en/filesystem.configuration.php
Previous Comments:
------------------------------------------------------------------------
[2004-05-24 03:49:32] pollita@php.net
The documentation was incorrect. allow_url_fopen is meant to be a
security feature for allowing the system administrator to completely
prohibit the use of url fopen wrappers. To allow it to be overridden
with a simple ini_set() would negate that purpose.
The documentation sources have been updated to read PHP_INI_SYSTEM and
should show as such in the next build of the online manual.
------------------------------------------------------------------------
[2004-05-23 21:15:32] iwonderiftheyllpostthistoapublicnewsgrou
Description:
------------
To improve security against poor coding I wish to disable
allow_url_fopen by default and allow users who have a legitimate need
for it to enable it themselves via use of .htaccess or ini_set(). Given
that allow_url_fopen is listed as PHP_INI_ALL in the docs I thought this
would be relatively easy, however I am unable to make it work:
Having allow_url_fopen off in php.ini disables it completely - the user
cannot activate it via .htaccess or ini_set(). So I tried to use
php_flag allow_url_fopen off in my httpd.conf to turn it off by default.
However this has no effect at all and users can happily use URL-fopen
functions without turning it on. Using php_admin_flag instead of
php_flag disables it entirely as if set via php.ini.
There appears to be no middle-ground here that lets the user control use
of this function instead of everybody or nobody having access.
Reproduce code:
---------------
httpd.conf
----------
php_flag allow_url_fopen off
test.php
--------
<?php
echo "<p>here is file:</p>";
readfile("http://www.r1ch.net/ohno");
ini_set ("allow_url_fopen", "1");
echo "<p>here is more file:</p>";
readfile("http://www.r1ch.net/ohno");
?>
Expected result:
----------------
here is file:
Warning: readfile(): URL file-access is disabled in the server
configuration in /.../test.php on line 2
here is more file:
ohno
Actual result:
--------------
here is file:
ohno
here is more file:
ohno
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=28497&edit=1