Welcome to the JaguarPC Community
JaguarPC
Sales: (888) 338-5261
Support: (888)-551-3050
Results 1 to 8 of 8

This is a discussion on How to get around the open_basedir restriction? in the VPS & Dedicated forum
I have a dedicated server, and for some reason PHP is returning open_basedir restriction warnings all over the place. As a result it can't find ...

  1. #1
    JPC Member
    Join Date
    Jan 2008
    Posts
    7

    Exclamation How to get around the open_basedir restriction?

    I have a dedicated server, and for some reason PHP is returning open_basedir restriction warnings all over the place. As a result it can't find a lot of the auxiliary files that I ought to have, and I think my MediaWiki installation will be permanently compromised as a result.

    I'd like to use my own php.ini file, but I can't seem to get the php engine to read it.

    What am I missing?

  2. #2
    Community Leader jason's Avatar
    Join Date
    Sep 2001
    Location
    Rochester, NY
    Posts
    6,003
    Is there a reason why you are using open_basedir right now, or is it just something that was enabled by default?

    Your server's main php.ini file is probably located in /etc. Hve you tried turning open_basedir off in that (note that if you are running PHP as an Apache module (mod_php) you will need to restart Apache before the change will be noticed). You can also change the setting for individual VirtualHosts in httpd.conf by setting

    [code]php_admin_value open_basedir none[/php]

    You can also use the above to set host-specific open_basedir paths. If you are running mod_php I don't believe you can use individual php.ini files.

    If you aren't using mod_php I'll need to know a bit more about your setup to help you debug.

    --Jason
    Jason Pitoniak
    Interbrite Communications
    www.interbrite.com www.kodiakskorner.com

  3. #3
    JPC Member
    Join Date
    Jan 2006
    Posts
    48
    Plesk came with it enabled by default on my server. I haven't been able to figure out how to actually disable, but I have edited the particular httpd.include for each domain/subdomain that I've needed to do so (mainly programs that use absolute path references and, of course, ones that make calls to scripts in other [sub]domains).

  4. #4
    JPC Member
    Join Date
    Jan 2008
    Posts
    7
    Thanks to everyone who replied.

    I imagine that some members of the JaguarPC tech team are going to have heart attacks when they learn that we are shamelesly "hacking" the httpd.include file--the one having the commented text that says DO NOT EDIT UNDER PENALTY OF LAW! Just kidding.

    Anyway, I changed the open_basedir to "/", and that solved the problem.

    What I'd really rather do, however, is list more than one open_basedir, in order to use only the paths that I absolutely need to have open.

  5. #5
    the Windlord Gwaihir's Avatar
    Join Date
    Jun 2002
    Posts
    2,562
    The problem with editing things you're not supposed to is usually that the next software update will overwrite your changes with the defaults again. On top of that, it may confuse support, as they'd likely work under the assumption that such files are indeed not touched.

    Note that you don't need open_basedir at all here at JagPC. The security issue open_basedir tries to plug (in combination with some other precautions that you'd have to take as well), is taken care of much better by running PHP in CGI mode. JagPC is well aware of how to do that, as all shared servers run that way. Once PHP runs in CGI mode you can use the standard system of file and folder permissions to regulate what accounts / users have access to what.
    Regards,

    Wim Heemskerk
    ---
    Visit MeCCG.net - Cardgaming in J.R.R. Tolkien's Middle-earth
    And Gwaihir.net - The Middle-earth CCG store

  6. #6
    Community Leader jason's Avatar
    Join Date
    Sep 2001
    Location
    Rochester, NY
    Posts
    6,003
    Quote Originally Posted by TerryH View Post
    What I'd really rather do, however, is list more than one open_basedir, in order to use only the paths that I absolutely need to have open.
    You can do that. Just separate the paths with a colon (or semicolon on Windows).

    php_admin_value open_basedir /home/user:/somewhere/else:/another/path

    --Jason
    Jason Pitoniak
    Interbrite Communications
    www.interbrite.com www.kodiakskorner.com

  7. #7
    Yeah, I know a LOT! Vin DSL's Avatar
    Join Date
    Mar 2003
    Location
    Arizona Uplands
    Posts
    10,775
    Quote Originally Posted by TerryH View Post
    I have a dedicated server, and for some reason PHP is returning open_basedir restriction warnings all over the place.

    What am I missing?
    Sounds like a bad path in a 'config' file (or something) to me.

    Why? Anecdotal evidence...

    http://www.lenon.com/postp226.html
    DISCLAIMER Any resemblance between the views expressed above and those of the owners and operators of this system is purely coincidental. Any resemblance between these views and my own are non-deterministic. The existence of Vin DSL is questionable. The existence of views in the absence of anyone to hold them is problematic. The existence of the reader is left as an exercise in the second-order coefficient.

    No Guts, No Story! VinDSL © 2010

  8. #8
    JPC Member
    Join Date
    Jan 2006
    Posts
    48
    What I really want to do is find the source template for generating httpd.include and modify it to set the open_basedir path to the account's home directory. Setting it to root means that they can include anything they have the proper permissions for (something I don't want to do).
    My current workaround is creating /var/www/vhosts/DOMAIN/conf/vhost.conf and putting this into the file:
    Code:
    <Directory /var/www/vhosts/DOMAIN/httpdocs>
            <IfModule sapi_apache2.c>
                    php_admin_value open_basedir "/var/www/vhosts/DOMAIN/"
            </IfModule>
            <IfModule mod_php5.c>
                    php_admin_value open_basedir "/var/www/vhosts/DOMAIN/"
            </IfModule>
    </Directory>
    It also works for subdomains (As long as it is modified accordingly).

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •