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/domain.com/public_html/wp-content/db.php) is not within the allowed path(s): (/home/username/web/domain.com/public_html:/home/username/tmp) in /home/username/web/domain.com/public_html/wp-includes/load.php 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:
https://forum.vestacp.com/viewtopic.php?f=11&t=19082&p=79233#p79233
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!
Comments
So empty here ... leave a comment!