• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

open_basedir Still not working

W

webignite

Guest
I've tried every way of doing it listed on the boards. I have a PSA 7.01 using the vhost_ssl.conf setup and works without a hitch. I copied the settings over, and checked the full paths, but still no go. When I check phpinfo() it's not using my custom settings at all. It's using the default domain.com/httpsdocs:/tmp

Here's my error:

Warning: Unknown(): open_basedir restriction in effect. File(/usr/local/psa/home/vhosts/domain.com/httpdocs/index.php) is not within the allowed path(s): (/usr/local/psa/home/vhosts/securedomain.com/httpsdocs:/tmp) in Unknown on line 0

Warning: Unknown(/usr/local/psa/home/vhosts/domain.com/httpdocs/index.php): failed to open stream: Operation not permitted in Unknown on line 0

Warning: (null)(): Failed opening '/usr/local/psa/home/vhosts/domain.com/httpdocs/index.php' for inclusion (include_path='.:/usr/local/psa/apache/share/pear') in Unknown on line 0

Here's my vhost_ssl.conf file:

<Directory /usr/local/psa/home/vhosts/securedomain.com/httpsdocs:/tmp:/usr/local/psa/home/vhosts/domain.com/httpdocs/:/tmp>
php_admin_value open_basedir none
</Directory>


Been at this all day... any help would be appreciated.

And yes I've run all the restart commands etc, even down to restarting psa.
 

Warning: Unknown(): open_basedir restriction in effect. File(/usr/local/psa/home/vhosts/domain.com/httpdocs/index.php) is not within the allowed path(s): (/usr/local/psa/home/vhosts/securedomain.com/httpsdocs:/tmp) in Unknown on line 0

Warning: Unknown(/usr/local/psa/home/vhosts/domain.com/httpdocs/index.php): failed to open stream: Operation not permitted in Unknown on line 0

Warning: (null)(): Failed opening '/usr/local/psa/home/vhosts/domain.com/httpdocs/index.php' for inclusion (include_path='.:/usr/local/psa/apache/share/pear') in Unknown on line 0

Here's my vhost_ssl.conf file:

<Directory /usr/local/psa/home/vhosts/securedomain.com/httpsdocs:/tmp:/usr/local/psa/home/vhosts/domain.com/httpdocs/:/tmp>
php_admin_value open_basedir none
</Directory>


The file that has the error is in "httpdocs". Therefore you do have a vhost.conf file in addition to the vhost_ssl.conf file, right?
 
I do not have a vhost.conf file. I have an httpd.include and vhost_ssl.conf
 
try creating the vhost.conf file:

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

Your vhost_ssl.conf file should be:
<Directory /var/www/vhosts/domainname.com/httpsdocs/>
php_admin_value open_basedir none
</Directory>

make sure to run /usr/local/psa/admin/sbin/websrvmng -u --vhost-name=domainname.com
 
No matter what I change, my phpinfo() shows the "Local Value" of /usr/local/psa/home/vhosts/securedomain.com/httpsdocs:/tmp

and the "Master Value" of 'no value'
 
I noticed the path in your vhost_ssl file:

<Directory /usr/local/psa/home/vhosts/securedomain.com/httpsdocs :/tmp:/usr/local/psa/home/vhosts/domain.com/httpdocs/:/tmp>
php_admin_value open_basedir none
</Directory>


Is the path that is bolded correct? Plus, the rest should not be in this part of the statement.

I am also confused about the domain name. One place you refer to domain.com then in another, securedomain.com. It should only be "domain.com".
 
Basically it's a shared SSL. The cert is on securedomain.com

So I point all secure requests coming from domain.com to https://securedomain.com/domain.com

the domain.com in the url is a directory within securedomain.com httpsdocs dir which is symlinked to domain.com's httpdocs directory.

Complicated to explain.

So basically calling a secure page from domain.com the URL changes and reads https://www.securedomain.com/domain.com/securepage.html

domain.com is a symlink inside the httpsdocs folder back to the httpdocs folder on domain.com

Hope that makes sense?
 
Ok,

so the original "allowed path" is in
(/usr/local/psa/home/vhosts/securedomain.com/httpsdocs:/tmp)

and a script from domain.com/index.php is doing the processing.

The vhost_ssl.conf and vhost.conf files need to be in the securedomain.com/conf folder where the httpd.include file is located.

The two files should look like this "using your path" ( from your setup, I don't think you need the vhost.conf file, but given the trouble you are having, I would leave it in at first to eliminate it as a problem until you get it worked out.)

vhost.conf:
<Directory your path here/securedomain.com/httpdocs/>
php_admin_value open_basedir none
</Directory>

vhost_ssl.conf:
<Directory your path here/securedomain.com/httpsdocs/>
php_admin_value open_basedir none
</Directory>
 
Ok, All set and still seeing the same problem.

Also... I checked my apache start stuff, here's something odd:

./apachectl -t
Syntax error on line 2 of /usr/local/psa/home/vhosts/securedomain.com/conf/vhost.conf:
Invalid command 'php_admin_value', perhaps mis-spelled or defined by a module not included in the server configuration
 
That is extremely odd.

Ok, try this, instead of setting the php_admin_value to none, set it to the base folder:

php_admin_value open_basedir "/your path here/securedomain.com/httpsdocs:/"

(with the quotes included in the statement)
I have done this before to correct a problem I had with open_basedir
 
It's decided to randomly start working with the following:

vhost.conf:

<Directory /usr/local/psa/home/vhosts/securedomain.com/httpdocs/>
php_admin_value open_basedir none
</Directory>

vhost_ssl.conf:

<Directory /usr/local/psa/home/vhosts/securedomain.com/httpsdocs/>
php_admin_value open_basedir none
</Directory>

Apache is still complaining about:

Invalid command 'php_admin_value', perhaps mis-spelled or defined by a module not included in the server configuration


I've no idea why it would though. I've got some more domains to setup on this tomorrow so I'll see how they go.

I appreciate the help. If you can come up with a reason it would be complaining about that error though, let me know, it does it for every domain that I have anything set in the vhost.conf or vhost_ssl.conf files.
 
Glad it's working for you. open_basedir problem are a bear to correct. I'll see what I can find out about the error.
 
Originally posted by webignite
It's decided to randomly start working with the following:

vhost.conf:

<Directory /usr/local/psa/home/vhosts/securedomain.com/httpdocs/>
php_admin_value open_basedir none
</Directory>

vhost_ssl.conf:

<Directory /usr/local/psa/home/vhosts/securedomain.com/httpsdocs/>
php_admin_value open_basedir none
</Directory>

Apache is still complaining about:

Invalid command 'php_admin_value', perhaps mis-spelled or defined by a module not included in the server configuration

If you start using the this notation in the conf file - Apache shouldn't complain :)

Ie.

Code:
<Directory /usr/local/psa/home/vhosts/securedomain.com/httpdocs/>
  <IfModule mod_php4.c>
    php_admin_value open_basedir none
    php_admin_flag safe_mode off
  </IfModule>
</Directory>

etc.

This is for PHP4 - if you're using PHP5 you change it to:

<IfModule mod_php5.c>
 
Back
Top