Moving WordPress Site to Php 7 open_basedir Error

Yesterday, I had to transfer a website from my server to a new server. My old server had CentOs and PHP 5.6, the new server had Ubuntu 18 and PHP 7 both servers were running Vesta Cp as the hosting control panel.

Today I ran into this PHP error message:

Warning: file_exists(): open_basedir restriction in effect. File(/home/username/web/ is not within the allowed path(s): (/home/username/web/ in   /home/username/web/ on line 414   

Basically I was trying to move one of my wordpress website to a new server. I use Vesta Control Panel, so basically a user backup, user restore. After I restored the website, I logged in to the wordpress backend. There I was greeted with the above error message.

Solution, thanks to vesta cp forms:
I was able to fix the problem by commenting out two lines in the apache template files:

1) cd /usr/local/vesta/data/templates/web

2) edit the default.tpl and default.stpl using nano
apt-get install nano -y && nano default.tpl default.stpl

3) Find and remove:
php_admin_value open_basedir %docroot%:%home%/%user%/tmp

4) Rebuild the User:
sudo /usr/local/vesta/bin/v-rebuild-user $username

5) Done!


So empty here ... leave a comment!

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.