Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Overriding open_basedir

Status
Not open for further replies.

Dustman

Programmer
May 7, 2001
320
US
Actually, I need to be albe to keep from overriding open_basedir. Here's the situation:

I've got a server running Plesk 6.0 on Redhat Enterprise 2.1. PHP 4.3.4

I have lots of domains setup that use shared classes located in /home/dropin/current/classes. By default, plesk turns on open_basedir for each dir and limits it to that domains home dir which keeps me from being able to use the shared classes. I can comment them out in the custom httpd.include file that is created each time but I need a way around this.. I can't keep going in and commenting out things everytime I make changes with plesk.

I've dug and dug through plesk trying to find a place where I can turn it off globally and so far have found nothing. I'm now trying to go down the path of writing something in the main httpd.conf file that will keep it from being overwritten in a later included conf file.

Anybody have an idea?

-Dustin
Rom 8:28
 
I assume that Plesk is inserting a line like:

php_admin_value open_basedir "<some directory>"

in all the individual websites' config files that are included into httpd.conf.

If so, there's no configuration setting you can put anywhere that will globally override that setting.


PHP's open_basedir directive is wise to symbolic links, so you can't link around the problem. You can, however, use mount --bind to mount another part of the filesystem to a local directory. Since it's a mount not a link, open_basedir will allow you to use code through the mount.

If you can't convince Plesk to quit adding the php_admin_value setting, might it be possible to make Plesk set up the mount when it creates a new directory for a new web site?

Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Yah.. thats what I was afraid of. It seems like no matter what I'm going to have to rig it. Hopefully there will be a fix for it in Plesk 7..

I have the option of adding a second config file to each account that will be processed after plesk's config but I'm still working on a way to automaticlly generate the file. Even at that.. I'm not sure if I can overrite this anyways.. its all in a virtual host statement.

Plesk creates one of these files for every domain I add and includes it after my httpd.conf
Code:
<VirtualHost 69.20.65.###:80>
        ServerName   domainXYZ.com
        ServerAlias  [URL unfurl="true"]www.domainXYZ.com[/URL]
        UseCanonicalName Off
        User         domainXYZ
        Group        psacln
        ServerAdmin  "admin@domainXYZ.com"
        DocumentRoot /home/httpd/vhosts/domainXYZ.com/httpdocs
        CustomLog  /home/httpd/vhosts/domainXYZ.com/statistics/logs/access_log combined
        ErrorLog   /home/httpd/vhosts/domainXYZ.com/statistics/logs/error_log
<IfModule mod_userdir.c>
        UserDir /home/httpd/vhosts/domainXYZ.com/web_users
</IfModule>
        ScriptAlias  /cgi-bin/ /home/httpd/vhosts/domainXYZ.com/cgi-bin/
        Alias  /webstat /home/httpd/vhosts/domainXYZ.com/statistics/webstat/
        Alias  /ftpstat /home/httpd/vhosts/domainXYZ.com/statistics/ftpstat/
        <IfModule mod_ssl.c>
                SSLEngine off
        </IfModule>
        <Directory /home/httpd/vhosts/domainXYZ.com/httpdocs>
        <IfModule mod_php4.c>
                php_admin_flag engine on
                [COLOR=red]php_admin_value open_basedir "/home/httpd/vhosts/domainXYZ.com/httpdocs:/tmp"[/color]
        </IfModule>
                Options -Includes +ExecCGI
        </Directory>
</VirtualHost>

Currently the only way i've found to get around it is to manually comment out that line. Each time somebody changes an option through plesk it overrites that file. I can create a vhost.conf in the same dir and it will not touch it and include it after each httpd.conf file but it seems to me that I would have to overrite the entire virtual host statement.. in turn crippeling Plesk.

You know of any programs out there that will launch a script anytime a file is written? I could parse the file and comment it out everytime plesk overrites it..

-Dustin
Rom 8:28
 
After perusing the Plesk 6 manuals, I did see something.

The manual mentions a custom httpd.include for each domain. You create the vhost.conf file for each domain, and Plesk will include it.

Since it looks like Plesk uses skeletons for user directory management, you could add overriding PHP configuration directives to a vhost.conf file and add it to the skeleton.

If the client-directory vhost.conf is included into the client-directory httpd.include at a point after the line where Plesk has added the php_admin_value line, then your new php_admin_value should override the one added by Plesk.

Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Yeah.. thats what I've been toying with. If I turn the open_basedir off after all the individual httpd.include files (like the one posted above) are processed.. will it work? I was under the impression that you cannot override something that is in its own virtual host container..

-Dustin
Rom 8:28
 
Damn.

Yeah, you're right. The php_admin_value setting that takes place in the most restrictive context takes precedence.

Does Plesk's skeleton system allow for templates? Particularly user-directory expansion?

I mean, does Pleak have a mechanism whereby you can create a vhost.conf skeleton file like

<Directory %USER_DIR%>
php_admin_value open_basedir ""
</Directory>

and have Plesk expand %USER_DIR% to the appropriate value?

Want the best answers? Ask the best questions!

TANSTAAFL!!
 
From what I've seen so far it does.. I haven't tried it yet because I don't want to break stuff during the day. I'll try some stuff this weekend.

If I put
<Directory "/home/httpd/vhosts/domainXYZ.com/httpdocs">
php_admin_value open_basedir ""
</Directory>

in vhost.conf.. I think its got a chace of working. I didn't think you could override a <directory> tag declared inside a virtual host tag, from outside of the virtual host.. even if its afterwards. According to the following post, it should work..


Thanks for the help.. its nice to know I'm still on the right track. Have a good weekend!



-Dustin
Rom 8:28
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top