Score:0

How to fix PHP open_basedir restriction restricting access to subdirectory on nginx server

cn flag

I am using nginx with php-fpm, and we are receiving a lot of errors like this:

2022/01/23 12:48:13 [error] 5514#5514: *9277 FastCGI sent in stderr: "PHP message: PHP Warning:  file_exists(): open_basedir restriction in effect. File(/var/www/vhosts/evtm.dev.nick/wp-content/db.php) is not within the allowed path(s): (/var/www/vhosts/evtm.dev.nick/:/usr/lib/php/:/tmp/:/data/sucuri:/var/www/prepend/) in /var/www/vhosts/evtm.dev.nick/wp-includes/load.php on line 545" while reading response header from upstream, client: 10.0.2.33, server: dev-nick.evtm.com, request: "POST /?wc-ajax=get_refreshed_fragments HTTP/1.1", upstream: "fastcgi://unix:/var/run/php-fpm.sock:", host: "dev-nick.evtm.com", referrer: "https://dev-nick.evtm.com/"

It is saying that the file /var/www/vhosts/evtm.dev.nick/wp-content/db.php is not within the allowed path of /var/www/vhosts/evtm.dev.nick - when it clearly appears to be.

Is there something preventing it from working recursively?

Score:0
cn flag

The issue was a symlink file db.php. This was copied from another folder on another instance, and the symlink was pointing to that original file.

Unlinking the file and linking to the correct one resolved the issue.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.