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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 03 21:01:34 2025 UTC