Applicable to:
- Plesk For Linux
- Plesk for Windows
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:
PLESK_INFO: 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
...\httpdocs\wp-includes\l10n.php
. -
Find
WP_PLUGIN_DIR
and replace it withbasename( dirname( __FILE__ ) )
.
Example:
Original:CONFIG_TEXT: $path = WP_PLUGIN_DIR . '/' . trim( $plugin_rel_path, '/' );
Modified:
CONFIG_TEXT: $path = basename( dirname( __FILE__ ) );
-
Save changes.
Comments
5 comments
Solved. First I have changed only open_basedir in Domain > example.com > PHP Settings. Now I I have Changed the open_basedir parameter in my .user.php also like open_basedir="none"
Now it is working fine
@Joseph Anand
Thank you for the feedback. I added notice about '
.user.ini' file to the article.
Thanks Joseph Anand! Its working!!
Hi, so I am having the same issue:
[22-Jul-2022 06:51:08 UTC] PHP Warning: file_exists(): open_basedir restriction in effect. File(C:\inetpub\vhosts\.../wp-admin/admin.php) is not within the allowed path(s): (C:/Inetpub/vhosts/...;C:\windows\Temp\) in C:\inetpub\vhosts\...\httpdocs\wp-admin\menu-header.php on line 257
I have done quite a few Wordpress sites, but this is the first time I have had this problem on any of them, but it is also the first client using plesk.
What exactly am I supposed to do?
I went to menu-header.php on line 257:
&& file_exists( WP_PLUGIN_DIR . "/$sub_file" )
I am not exactly sure what I need to change. Please advise on what I need to change?
Please sign in to leave a comment.