Symptoms
When opening a website in a web-browser or installing a WordPress plugin/theme at Plesk > WordPress > example.com > Plugins/Themes, the WordPress plugin/theme references to a non-existent path and, as a result, fails due to open_basedir
restiriction:
open_basedir restriction in effect. File(/var/www/vhosts/example.com/public_html/wp-content/cache/wp-rocket/www.example.com/shop/index-https.html/index-https.html_gzip) is not within the allowed path(s): (/var/www/vhosts/example.com/:/tmp/) in /var/www/vhosts/example.com/public_html/wp-content/plugins/wp-rocket/inc/classes/Buffer/class-cache.php on line 96
Cause
The absolute path to the WordPress file is merged with the path to the plugin directory and, as a result, restricted by open_basedir
PHP parameter.
Resolution
Contact the WordPress plugin/theme developer to fid out how to fix the path.
The solution below is an example of how the issue can be fixed. It may differ for different plugins and themes:
-
Go to Domains > example.com > File Manager.
-
Edit the file mentioned in the error. In this example, the file is
...httpdocswp-includesl10n.php
. -
Find
WP_PLUGIN_DIR
and replace it withbasename( dirname( __FILE__ ) )
.
Example:
Original:$path = WP_PLUGIN_DIR . '/' . trim( $plugin_rel_path, '/' );
Modified:
$path = basename( dirname( __FILE__ ) );
-
Save changes.