• 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!
  • Support for BIND DNS has been removed from Plesk for Windows due to security and maintenance risks.
    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.

somebody pleeeease help with open_basedir

S

sem101

Guest
I've RTFM'd 100+ times and I've scoured these forums. I just can't get it to work.

My phpinfo says "no value" across the board, I've restarted Apache a million times, I ran the Plesk reboot script, etc.

Someone please post a 1,2,3 step for getting my vhost.conf to just work.

I all I need to do is give access to my domains ABOVE httpdocs so they can simply put a sessions directory there.

I need to get this to work tonight. It's driving me mad. Please, please help! thanks

*going nuts*

P.S. Please don't link me to KB#432
 
I'm sorry, but that KB article really has a solution that is working on all of our servers.

You did replace HTTPD_VHOSTS_D by the dir used on your OS? If you don't know which dir this is, check the output of grep HTTPD_VHOSTS_D /etc/psa/psa.conf.
 
Hello, here is what I do:

1. php.ini

open_basedir =

RESTART APACHE


2. vhost.conf

ssh [email protected]
cd /var/www/vhosts/domain.com/conf
cat > vhost.conf

<Directory /var/www/vhosts/domain.com/httpdocs>
php_admin_flag engine on
php_admin_value open_basedir none
</Directory>

or

<Directory /var/www/vhosts/domain.com/httpdocs>
php_admin_value open_basedir "/var/www/vhosts/domain.com/tmp:/"
</Directory>

or

<Directory /var/www/vhosts/domain.com/httpdocs>
php_admin_value open_basedir = none
</Directory>

etc.

3. Plesk Utility

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

4. FTP

- Navigate to ../vhosts/domain.com
- mkd sessions
- "Permission Denied"
 
That's not exactly what the Knowledge Base article recommends.

1. Don't edit /etc/php.ini (you might want to change it back).
2. Just create a vhost.conf file in the domain's conf dir and add the path you want PHP to be able to access to the default setting:
Code:
<Directory /var/www/vhosts/domain.com/httpdocs>
php_admin_value open_basedir "/var/www/vhosts/domain.com/httpdocs:/tmp:/var/www/vhosts/domain.com/sessions"
</Directory>
3. Run /usr/local/psa/admin/sbin/websrvmng -a -v to make sure vhost.conf is included in the domain's httpd.include file.

Also note that you will not be able to create directories via FTP as the domain user doesn't have enough rights to create directories in /var/www/vhosts/domain.com. You'll have to create the sessions dir as root via SSH. Make sure the dir you added has ownership and permissions set up correctly or PHP will still not be able to write to it. This has nothing to do with PHP's open_basedir by the way.
 
Also note that you will not be able to create directories via FTP as the domain user doesn't have enough rights to create directories in /var/www/vhosts/domain.com. You'll have to create the sessions dir as root via SSH. Make sure the dir you added has ownership and permissions set up correctly or PHP will still not be able to write to it. This has nothing to do with PHP's open_basedir by the way.

Thank you for your help! I think this is the information I was looking for. Is this in the Docs and I missed it? I would like my Clients to create Directories above httpdocs. So this is not possible in Plesk?
 
/var/www/vhosts/domain.com has 755 permissions and is owned by root.root by default, so a regular user will not be able to create directories in there. You could try to change the permissions on these domain directories, but I don't know if that plays nice with Plesk.
 
Thanks breun, I'm doing the chown and chgrp now on the new directories. Last question, if I need 2 directories, do I do it like this...

Code:
<Directory /var/www/vhosts/domain.com/httpdocs>
php_admin_value open_basedir "/var/www/vhosts/domain.com/httpdocs:/tmp:/var/www/vhosts/domain.com/sessions1/:/tmp:/var/www/vhosts/domain.com/sessions2"
</Directory>

or

Code:
<Directory /var/www/vhosts/domain.com/httpdocs>
php_admin_value open_basedir "/var/www/vhosts/domain.com/httpdocs:/tmp:/var/www/vhosts/domain.com/sessions1"
</Directory>

<Directory /var/www/vhosts/domain.com/httpdocs>
php_admin_value open_basedir "/var/www/vhosts/domain.com/httpdocs:/tmp:/var/www/vhosts/domain.com/sessions2"
</Directory>

Thanks! I think I understand now.
 
Use this:

Code:
<Directory /var/www/vhosts/domain.com/httpdocs>
php_admin_value open_basedir "/var/www/vhosts/domain.com/httpdocs:/tmp:/var/www/vhosts/domain.com/sessions1:/var/www/vhosts/domain.com/sessions2"
</Directory>

Your first options lists /tmp twice, although that would probably work too. You don't want to set your open_basedir path twice (your second option).

Remember that it is just a ':'-separated list of directories. Any path not starting with a dir in that list will be unavailable to PHP. It's just one of the security measures meant to minimize the harm a PHP script can do.
 
WHERE DO I RUN open_basedir UTILITY?

Originally posted by breun
That's not exactly what the Knowledge Base article recommends.

1. Don't edit /etc/php.ini (you might want to change it back).
2. Just create a vhost.conf file in the domain's conf dir and add the path you want PHP to be able to access to the default setting:
Code:
<Directory /var/www/vhosts/domain.com/httpdocs>
php_admin_value open_basedir "/var/www/vhosts/domain.com/httpdocs:/tmp:/var/www/vhosts/domain.com/sessions"
</Directory>
3. Run /usr/local/psa/admin/sbin/websrvmng -a -v to make sure vhost.conf is included in the domain's httpd.include file.

Also note that you will not be able to create directories via FTP as the domain user doesn't have enough rights to create directories in /var/www/vhosts/domain.com. You'll have to create the sessions dir as root via SSH. Make sure the dir you added has ownership and permissions set up correctly or PHP will still not be able to write to it. This has nothing to do with PHP's open_basedir by the way.

Once the changes are made you need to run the utility below for the changes to take effect and restart Apache service.

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

WHERE DO I RUN THE ABOVE UTILITY?
 
Re: WHERE DO I RUN open_basedir UTILITY?

WHERE DO I RUN THE ABOVE UTILITY?

Hi FireIslandMan, you will need to SSH into your server as root and enter the command.
 
Thanks for your reply and help sem101! BTW, I'm on a 1and1.com VPS 1 shared hosting server and their support in this area sucks. Here are more ignorant questions:

Once I log in to server as root using Putty SSH terminal I get:

[root@s15248951 ~]#

DO I ENTER THE /usr/local/psa/admin/sbin/websrvmng -a -v COMMAND AFTER THE # AND HIT ENTER?

AFTER I HIT ENTER, I GET [root@s15248951 ~]# AGAIN SO HOW DO I KNOW THE UTILITY WORKED AND IT'S OK TO RESTART APACHE?
 
Yep.

1. Follow the great instructions above by breun step-by-step first to create/edit your vhost.conf or vhost_ssl.conf.

2. Then SSH as root and type or paste the utility - hit ENTER. If utility worked, you will be at the command-line prompt again with no errors.

3. Restarting Apache is *optional* but you may wish to do it just in case.

4. You can see if open_basedir is working by uploading a phpinfo.php file to your server and scroll/search to open_basedir and view the new path.

5. If the path matches your vhost.conf or vhost_ssl.conf files then it worked!
 
Back
Top