php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20117 open_basedir not working
Submitted: 2002-10-27 06:40 UTC Modified: 2005-01-31 22:57 UTC
From: david at ols dot es Assigned:
Status: Not a bug Package: Safe Mode/open_basedir
PHP Version: 4.2.3 OS: Solaris 8 & Linux Madrake
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: david at ols dot es
New email:
PHP Version: OS:

 

 [2002-10-27 06:40 UTC] david at ols dot es
a scripts located in open_basedir path is unable to include another script in the same directory with error " open_basedir restriction in effect. File is in wrong directory" where the first script is included
from another script.

You can reproduce this situation with 3 php scripts with safe_mode on:

/usr/local/http-docs/common/scripts/test.php --------------

<?php
include("test/test.php");
?>

/usr/local/http-docs/common/lib/test/test.php -------------

<?php
phpinfo();
include("hello.php");
?>

/usr/local/http-docs/common/lib/test/hello.php -------------

<?php
echo "hello world";
?>

Apache configuration to reproduce the situation --------------

<Directory "/usr/local/http-docs/common/lib/">
    Options none
    AllowOverride None
    Order allow,deny
    Deny from all
</Directory>

Alias /scripts/ "/usr/local/http-docs/common/scripts/"

<Directory "/usr/local/http-docs/common/scripts/">
    Options none
    AllowOverride None
    Order allow,deny
    Allow from all
    php_admin_value open_basedir /usr/local/http-docs/common/scripts/:/usr/local/http-docs/common/lib
</Directory>

<VirtualHost 192.168.0.3>
        ServerName 192.168.0.3
        DocumentRoot /usr/local/http-docs/test
        php_admin_value open_basedir /usr/local/http-docs/test:/usr/local/http-docs/common/lib:/var/tmp:/usr/local/lib/php
        php_admin_value doc_root /usr/local/http-docs/test
</VirtualHost>

to reproduce the error just go to https://192.168.0.3/scripts/test.php
altough phpinfo() on /usr/local/http-docs/common/lib/test/test.php
shows that open_basedir includes /usr/local/http-docs/common/lib
php fails to open hello.php

php configure line (Solaris):

./configure --with-mysql --with-apache=$(APACHE) \
                --enable-track-vars --enable-versioning \
                --enable-sockets --enable-dbase \
                --enable-exif \
                --enable-ftp --with-mm \
                --with-dbase --with-ftp --with-ndbm \
                --with-gd=/usr/local --enable-gd-native-ttf \
                --with-zlib-dir=/usr/local \
                --with-curl=/usr/local --with-openssl \
                --with-pcre --with-mcrypt=/usr/local/lib --with-xml \
                --enable-ucd-snmp-hack \
                --enable-inline-optimization \
                --disable-debug --disable-display-source \
                --with-jpeg-dir=/opt/sfw \
                --with-imap=$(IMAP) --with-zlib \
                --with-png-dir=/opt/sfw --with-tiff-dir=/opt/sfw

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-10-27 06:52 UTC] david at ols dot es
BTW, all scripts and directories have correct permissions and include_path is ./:/usr/local/http-docs/common/lib:/usr/local/lib/php
 [2002-10-27 10:19 UTC] sniper@php.net
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. Because of this, we hope you add your comments
to the original bug instead.

Thank you for your interest in PHP.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 09:01:27 2024 UTC