2010-06-17

ServersMan@VPSでopen_basedirを無効にする方法のメモ

ServersMan@VPSでWordPressのPermalinksを設定しようとすると、以下のようなopen_basedirのWarningが出てしまいます。

Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(/.htaccess) is not within the allowed path(s): (/tmp/:/var/lib/php/session/:/home/.sites/28/site1/) in /home/.sites/28/site1/web/blog/wp-admin/options-permalink.php on line 141


Warning: is_writable() [function.is-writable]: open_basedir restriction in effect. File(/) is not within the allowed path(s): (/tmp/:/var/lib/php/session/:/home/.sites/28/site1/) in /home/.sites/28/site1/web/blog/wp-admin/options-permalink.php on line 141


Warning: is_writable() [function.is-writable]: open_basedir restriction in effect. File(/.htaccess) is not within the allowed path(s): (/tmp/:/var/lib/php/session/:/home/.sites/28/site1/) in /home/.sites/28/site1/web/blog/wp-admin/options-permalink.php on line 141


Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(/.htaccess) is not within the allowed path(s): (/tmp/:/var/lib/php/session/:/home/.sites/28/site1/) in /home/.sites/28/site1/web/blog/wp-admin/includes/misc.php on line 133


Warning: is_writable() [function.is-writable]: open_basedir restriction in effect. File(/) is not within the allowed path(s): (/tmp/:/var/lib/php/session/:/home/.sites/28/site1/) in /home/.sites/28/site1/web/blog/wp-admin/includes/misc.php on line 133


Warning: is_writable() [function.is-writable]: open_basedir restriction in effect. File(/.htaccess) is not within the allowed path(s): (/tmp/:/var/lib/php/session/:/home/.sites/28/site1/) in /home/.sites/28/site1/web/blog/wp-admin/includes/misc.php on line 133


Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(/web.config) is not within the allowed path(s): (/tmp/:/var/lib/php/session/:/home/.sites/28/site1/) in /home/.sites/28/site1/web/blog/wp-admin/includes/misc.php on line 158


Warning: is_dir() [function.is-dir]: open_basedir restriction in effect. File(/111859504c19f991a1ca2.tmp) is not within the allowed path(s): (/tmp/:/var/lib/php/session/:/home/.sites/28/site1/) in /home/.sites/28/site1/web/blog/wp-admin/includes/misc.php on line 574


Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(/111859504c19f991a1ca2.tmp) is not within the allowed path(s): (/tmp/:/var/lib/php/session/:/home/.sites/28/site1/) in /home/.sites/28/site1/web/blog/wp-admin/includes/misc.php on line 577


Warning: is_dir() [function.is-dir]: open_basedir restriction in effect. File(/web.config) is not within the allowed path(s): (/tmp/:/var/lib/php/session/:/home/.sites/28/site1/) in /home/.sites/28/site1/web/blog/wp-admin/includes/misc.php on line 574


Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(/web.config) is not within the allowed path(s): (/tmp/:/var/lib/php/session/:/home/.sites/28/site1/) in /home/.sites/28/site1/web/blog/wp-admin/includes/misc.php on line 577


open_basedirとは、PHPを実行できるディレクトリを指定したものに制限するための設定です。

phpinfo()で設定を確認してみると、以下のようにデフォルトで設定されています。
open_basedir /tmp/:/var/lib/php/session/:/home/.sites/28/site1/ /tmp/:/var/lib/php/session/

このWarningを無効にするには、</etc/httpd/conf/vhosts/site1>(仮想サイトsite1の設定)で定義されているopen_basedirを無効にします。

#php_admin_value open_basedir /tmp/:/var/lib/php/session/:/home/.sites/28/site1/
php_admin_value open_basedir none

apacheを再起動するのをお忘れなく。
/etc/init.d/httpd restart

なお、BlueOnyx上でも、open_basedirのLocal Value(仮想サイト特有の設定)を確認できます。

[サイトの管理] - [該当する仮想サイト名] - [サービス] - [PHP] - [Open basedir] 



No comments: