• Introducing WebPros Cloud - a fully managed infrastructure platform purpose-built to simplify the deployment of WebPros products !  WebPros Cloud enables you to easily deliver WebPros solutions — without the complexity of managing the infrastructure.
    Join the pilot program today!
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.

include and open_basedir problem

P

petr.pavel

Guest
Hi folks,
the issue I'm having is to do both with PHP 5.0.4 and Plesk 8.0.1.

The core problem is this:
http://bugs.php.net/bug.php?id=29170

I don't understand why it's marked as Bogus when the last entry doesn't offer anything better than a workaround. According to this
http://www.php.net/include/
the code should work fine.
Another workaround is to clear open_basedir variable.

Because I don't want to modify all my scripts that worked so nicely under PHP 4.3.8 I want to find some server-wide solution.
It means that I don't want to set up a vhost.conf file for each hosting clearing the open_basedir. I want something that I do once and it works for new domains too.

So please someone either confirm to me that it really is a PHP bug and upgrading to PHP 5.1 will fix it and won't break Plesk.

Or please reveal to me where can I find httpd.include template that defines open_basedir for each site so that I can remove the definitions.
I don't see how I could do it in global /etc/httpd/conf/httpd.conf for all VirtualHosts.

I suspect that httpd.include template is hard-coded into websrvmng. It means no hope for me.
Or is there? Any ideas?

Thanks
Petr 'PePa' Pavel
 
the solution (sort of)

Here's a digest of what I learnt from here
http://forum.swsoft.com/showthread.php?threadid=30731

* log in as root and create directory
/var/www/vhosts/.skel/0/conf
(I didn't find a way how to create a directory in Plesk / Server / Skeleton Management)

* into this new directory create file vhost.conf with following content:
<Directory /var/www/vhosts/@domain_name@/httpdocs>
php_admin_value open_basedir none
</Directory>

<Directory /var/www/vhosts/@domain_name@/httpsdocs>
php_admin_value open_basedir none
</Directory>

* then create a new domain using Plesk

Good news is that this trick works for http:// addresses
The bad news is that it doesn't work for https:// regardless of the state of "Use a single directory for housing SSL and non-SSL content" in
Plesk / Domains / yourdomain / Setup

I guess we can consider it a victory though :)

Note that this applies to newly created domains. You still have to create conf/vhost.conf for each existing domain and run
/usr/local/psa/admin/bin/websrvmng -v -a -r
I doubt that @domain_name@ works for existing domains so you'll probably have to put real domain name in its place.

Petr 'PePa' Pavel
 
i'm having this problem too. that is an easy fix but what about subdomains? is there a placeholder like @domain_name@ but for subdomains? maybe @subdomain_name@? :confused:
Something to use like this:
<Directory /var/www/vhosts/@domain_name@/subdomains/@subdomain_name@/httpdocs>
And, if yes, this conf should go in /var/www/vhosts/.skel/0/conf or in something llike /var/www/vhosts/.skel/0/subdomains/@subdomain_name@/conf?

I tried to search for a list of placeholder but can't find any.

I'm very confused about this :rolleyes:
 
I would love to know how to setup skeletons for subdomain vhost.conf files as well.

Right now I have domains working automatically, but the subdomains I have to manually edit.

Why isnt this functionality included by defualt in plesk, and where do we find more about it. It's obviously not in the manual.
 
Well i had the same issue and after a lot of search i finally disabled the open_basedir from my domain and subdomains too. You can find the solution here: just click NEXT and you will find the solution.

To disable this value for your domain, follow these steps:

1. Create with notepad a file called vhost.conf and add these lines:

<Directory /var/www/vhosts/example.com/httpdocs>
php_admin_flag safe_mode off
php_admin_value open_basedir none
</Directory>

2. Go to /var/www/vhosts/example.com/conf inside the conf directory you will find a file called httpd.include. Edit this file and add this line Include /var/www/vhosts/example.com/conf/vhost.conf after this code:

<IfModule sapi_apache2.c>
php_admin_flag engine on
php_admin_flag safe_mode off
php_admin_value open_basedir "/var/www/vhosts/example.com/httpdocs:/tmp"
</IfModule>
<IfModule mod_php5.c>
php_admin_flag engine on
php_admin_flag safe_mode off
php_admin_value open_basedir "/var/www/vhosts/example.com/httpdocs:/tmp"
</IfModule>

It will look like this:

<IfModule sapi_apache2.c>
php_admin_flag engine on
php_admin_flag safe_mode off
php_admin_value open_basedir "/var/www/vhosts/example.com/httpdocs:/tmp"
</IfModule>
<IfModule mod_php5.c>
php_admin_flag engine on
php_admin_flag safe_mode off
php_admin_value open_basedir "/var/www/vhosts/example.com/httpdocs:/tmp"
</IfModule>
Include /var/www/vhosts/example.com/conf/vhost.conf

You will find the code above several times, so add the line Include /var/www/vhosts/example.com/conf/vhost.conf at all of the lines.

3. Upload the edited httpd.include and vhost.conf files at the conf directory of your domain.

4. If you want to disable open_basedir for your subdomains too, then edit the vhost.conf file and add these lines:

<Directory /var/www/vhosts/example.com/subdomains/your_subdomain_name/httpdocs>
php_admin_flag safe_mode off
php_admin_value open_basedir none
</Directory>
You have to change the your_subdomain_name with yours subdomain name.

5. Upload the vhost.conf at the /var/www/vhosts/example.com/subdomains/your_subdomain_name/conf

6. Using SSH or directry from the server, execute this command (you have to login as root):

/usr/local/psa/admin/sbin/websrvmng -v -a

Restart Apache and the open_basedir is gone for your domain and your subdomain.

NOTE: you have to do all of the steps above for ALL domains and subdomains. Do remebmer to change the example.com with your domain and the paths if are different from the above. If you follow all the above steps exactly, you will remove the open_basedir effect from your host.

I wish you good luck.
Regards
 
Originally posted by netzone
Well i had the same issue and after a lot of search i finally disabled the open_basedir from my domain and subdomains too. You can find the solution here: just click NEXT and you will find the solution.

To disable this value for your domain, follow these steps:

1. Create with notepad a file called vhost.conf and add these lines:

<Directory /var/www/vhosts/example.com/httpdocs>
php_admin_flag safe_mode off
php_admin_value open_basedir none
</Directory>

2. Go to /var/www/vhosts/example.com/conf inside the conf directory you will find a file called httpd.include. Edit this file and add this line Include /var/www/vhosts/example.com/conf/vhost.conf after this code:

<IfModule sapi_apache2.c>
php_admin_flag engine on
php_admin_flag safe_mode off
php_admin_value open_basedir "/var/www/vhosts/example.com/httpdocs:/tmp"
</IfModule>
<IfModule mod_php5.c>
php_admin_flag engine on
php_admin_flag safe_mode off
php_admin_value open_basedir "/var/www/vhosts/example.com/httpdocs:/tmp"
</IfModule>

It will look like this:

<IfModule sapi_apache2.c>
php_admin_flag engine on
php_admin_flag safe_mode off
php_admin_value open_basedir "/var/www/vhosts/example.com/httpdocs:/tmp"
</IfModule>
<IfModule mod_php5.c>
php_admin_flag engine on
php_admin_flag safe_mode off
php_admin_value open_basedir "/var/www/vhosts/example.com/httpdocs:/tmp"
</IfModule>
Include /var/www/vhosts/example.com/conf/vhost.conf

You will find the code above several times, so add the line Include /var/www/vhosts/example.com/conf/vhost.conf at all of the lines.

3. Upload the edited httpd.include and vhost.conf files at the conf directory of your domain.

4. If you want to disable open_basedir for your subdomains too, then edit the vhost.conf file and add these lines:

<Directory /var/www/vhosts/example.com/subdomains/your_subdomain_name/httpdocs>
php_admin_flag safe_mode off
php_admin_value open_basedir none
</Directory>
You have to change the your_subdomain_name with yours subdomain name.

5. Upload the vhost.conf at the /var/www/vhosts/example.com/subdomains/your_subdomain_name/conf

6. Using SSH or directry from the server, execute this command (you have to login as root):

/usr/local/psa/admin/sbin/websrvmng -v -a

Restart Apache and the open_basedir is gone for your domain and your subdomain.

NOTE: you have to do all of the steps above for ALL domains and subdomains. Do remebmer to change the example.com with your domain and the paths if are different from the above. If you follow all the above steps exactly, you will remove the open_basedir effect from your host.

I wish you good luck.
Regards

First of all, u can't do this couse httpd.include is rewritten every time you do changes to the domain from plesk. Second, you don't need to insert the include statement couse /usr/local/psa/admin/sbin/websrvmng -v -a do it automatically. Third, there is no solution as this is a php "problem" (php devs changed this behaviour as they think this is how openbase_dir should work) and no a plesk one.
I just switched back to the last php4 pkg before this change and i'm fine now.
 
Well after i made all the above about a month ago, everything works fine. I have tryed other solutions with no luck. Only with the above i shaw on the phpinfo no value to poen_basedir.
 
Back
Top