Skip to content

open_basedir not working following paths #13226

Open
@paulkudla

Description

@paulkudla

Description

The following code:
General random Occurances (Word Press Sites)

when using apache server with directory statement

php_admin_value open_basedir /data/www//:/var/log/:/usr/local/share/pear/

or

php_admin_value open_basedir /data/www/:/var/log:/usr/local/share/pear
(ending slashes removed) - documentation is not clear on multiple formtted directories but neither work as expected.

Resulted in this output:Random site crashes

Warning: Unknown: open_basedir restriction in effect. File(/data/www/team.22Racing.ca/index.php) is not within the allowed path(s): (/data/www/team.22Racing.ca/tmp/) in Unknown on line 0

Warning: Unknown: failed to open stream: Operation not permitted in Unknown on line 0

Fatal error: Unknown: Failed opening required '/data/www/team.22Racing.ca/index.php' (include_path='.:/usr/local/share/pear') in Unknown on line 0

Note that both are in the allowed path especially index.php ?

But I expected this output instead:
site should work as NO file(s) are being accessed outside their home directory.

With display errors on you get the error's reported above, with dispaly off it crashes the site so either way open_basedir is blocking file access?

but open_basedir fails anyways, this IS required to keep a shared server secured, aka the wordpress hack years ago that brough down myself, 1and1 hosting etc.

Please note this has been reported in various versions over the years (going back to 5.xx etc), any ticket opened did not carry any real fixes to this issue that appears to be php is not following the allowed path(s) properly into the path sub directories ?

This issue appears weather or not opcache, fpm etc is compiled in or not ?

See Bug(s) Reported 👍
https://bugs.php.net/bug.php?id=78764
https://bobcares.com/blog/wordpress-warning-open_basedir-restriction-in-effect/
https://bugs.php.net/bug.php?id=48880

Please note this is a production server running httpd-2.4.43, memcached, openssl, mod_fcgid-2.3.9, mod_wsgi-4.7.1,

I am trying to update to PHP 8.0.21 to see if that helps and will advise, however I am unable to goto the lastest PHP version due to incompatibility with elegant themes and other site(s) programming.

I am running the latest version of word press if that helps but this seems to be a low level file php issue (rights on all site are correct chmod 755)

I can provide test site duplicating the errors if you wish.

I am here to help, been programming for over 40 years and usually muddle through config issues like this?

PHP Version

PHP php-7.4.33

Operating System

Freebsd 12.1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions