I am migrating websites to a new server and one site that is using open_basedir in its sites-available file is giving me problems and just showing a blank page when I try to load it.
I have fixed it by moving the open_basedir config from the Apache VirtualHost to the front index.php page within an ini_set(). This fix bothers me though and I feel that I'm missing something. Is there a particular Apache setting that I need to change or something to get this to work in a VirtualHost config?
Note that I did restart apache after changing the sites-available file.
Here is the sites-available file:
<VirtualHost *:443>
ServerName www.mysite.com
ServerAdmin webmaster@mysite.com
DocumentRoot /var/www/www.mysite.com/content
php_flag open_basedir /var/www/www.mysite.com/
SSLEngine On
SSLCertificateFile /etc/ssl/certs/www_mysite_com.crt
SSLCertificateKeyFile /etc/ssl/private/www_mysite_com.key
SSLCACertificateFile /etc/ssl/certs/DigiCertCA.crt
RewriteEngine on
FileETag INode MTime Size
ExpiresActive On
ExpiresDefault "access plus 1 week"
ExpiresByType text/html "access plus 5 seconds"
CustomLog /var/log/apache2/access.log combined
</VirtualHost>
Here is the error Apache is giving me (/var/log/apache2/error.log):
... PHP Warning: Unknown: open_basedir restriction in effect. File(/var/www/www.mysite.com/content/index.php) is not within the allowed path(s): (0) in Unknown on line 0
... PHP Warning: Unknown: failed to open stream: Operation not permitted in Unknown on line 0
... PHP Fatal error: Unknown: Failed opening required '/var/www/www.mysite.com/content/index.php' (include_path='.:/usr/share/php:/usr/share/pear') in Unknown on line 0
I even tried to just set the base directory to root (php_flag open_basedir /) and it still gave me an error.
Existing server: Debian GNU/Linux 4.0, PHP Version 5.2.0-2, Apache 2.2.3
New server: Debian GNU/Linux 6.0, PHP Version 5.3.3-7+squeeze3, Apache 2.2.16