新VPSでPHPエラー『Warning: Unknown: open_basedir restriction in effect. File(/home/user/index.php) is not within the allowed path(s): (/tmp/:/var/lib/php/session/) in Unknown on line 0』

ちょっとこのDreamHostのサーバーが重くて仕方ない、あとWordPressサイトで404やら500が発生しすぎなので、引っ越しを画策しています。

そこでとりあえず、最近はやりのVPSサーバーを借りてみたんですが、色々設定してみたところ、ドメインを設定してApacheでルートを設定させるところまでは出来たんですが、肝心のPHPが動かない。こんなエラーが出ます。

Warning: Unknown: open_basedir restriction in effect. File(/home/user/html/index.php) is not within the allowed path(s): (/tmp/:/var/lib/php/session/) in Unknown on line 0

これは、PHPの設定で、PHPを動かすベースディレクトリを設定してしまっているためで、「そのパスではPHPが動かない」と怒られている状態のようです。

/etc/php.ini を開いて…

open_basedir = /tmp/:/var/lib/php/session/

となっているところをコメントアウトして

; open_basedir = /tmp/:/var/lib/php/session/

Apacheを再起動すればOKです。

広告

service httpd restart

About: dacelo


Leave a Reply

Your email address will not be published. Required fields are marked *