我正在将网站迁移到新服务器,并且在其站点中使用open_basedir的一个站点 - 可用文件给我提供了问题,并在我尝试加载时显示空白页它。PHP open_basedir在Apache中损坏,但在运行时在PHP中运行
我已经通过将open_basedir配置从Apache VirtualHost移动到ini_set()中的前端index.php页面来修复它。这个修复困扰了我,但我觉得我错过了一些东西。是否有一个特定的Apache设置,我需要改变或什么让这个工作在VirtualHost配置?
请注意,在更改站点可用文件后,我确实重新启动了apache。
这里是网站可用文件:
<VirtualHost *:443>
ServerName www.mysite.com
ServerAdmin [email protected]
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>
以下是错误的Apache是给我(/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
我甚至尝试只需将基本目录设置为root(php_flag open_basedir /),它仍然给我一个错误。
现有的服务器:的Debian GNU/Linux的4.0,PHP版本5.2.0-2,阿帕奇2.2.3
新服务器:的Debian GNU/Linux的6.0,PHP版本5.3.3-7 + squeeze3,Apache 2.2的0.16
PHP是否以Apache模块运行?否则,你不能使用'mod_php'提供的'php_flag'指令。 –