Open_basedir issue (kinsta)

Facing the following issue for several weeks and can’t get it solved. Problem occurs when calling $wpdb - (/wp-includes/wp-load.php line 412):

if ( file_exists( WP_CONTENT_DIR . '/db.php' ) )

2022/05/16 09:18:11 [error] 102518#102518: *3722311 FastCGI sent in stderr: "PHP message: PHP Warning: file_exists(): open_basedir restriction in effect. File(/www/eamplenl_975/public/releases/20220516073916/web/app/db.php) is not within the allowed path(s): (/www/eamplenl_975/public/current:/www/eamplenl_975/public/releases:/www/eamplenl_975/public:/www/eamplenl_975/mysqleditor:/www/eamplenl_975/web:/www/eamplenl_975/deploy:/www/eamplenl_975/deployment:/www/eamplenl_975/deployments:/usr/share:/tmp:/www/eamplenl_975/public/releases/20220510075554/web/app) in /www/eamplenl_975/public/releases/20220516073916/web/wp/wp-includes/load.php on line 412" while reading response header from upstream, client: 161.35.150.191, server: www.eample.nl, request: "GET //xyz.com HTTP/1.1", upstream: "fastcgi://unix:/var/run/php7.4-fpm-eamplenl.sock:", host: "www.eample.nl:42856"

Site is running on Kinsta. Would be great if anyone can assist. Thanks!

Update:

I have found out that after each deploy a symlink is automatically being created. Please check below

./public/releases/20220516155944/web/app/db.php → /srv/www/example.nl/current/web/app/plugins/query-monitor/wp-content/db.php

./public/shared/source/site/web/app/db.php → /srv/www/trustdeals.nl/current/web/app/plugins/query-monitor/wp-content/db.php

When I manually delete the symlink through SSH the problem is solved. But after each deploy the symlink is automatically re-created. This is really strange since I removed query-monitor from composer.json.

1 Like

Hi @timmen22,

Having the same issue and I can confirm that this solution works.
Is it possible to add the deploy hook to remove the symlinks after each deploy?