You receive a repeated error in the logs about an open_basedir restriction in effect

Problem Description

You may experience any of the following:
  • A repeated error in the server logs like this: PHP Warning:  is_dir(): open_basedir restriction in effect. File(/) is not within the allowed path(s)
  • You may find images and other resources on your website are not appearing
  • Your site may load exceptionally slowly or not at all with a gateway timeout error
  • Attempting to upload files in the WordPress admin fails
Problem Resolution

A quick workaround is to disable the open_basedir PHP setting in Plesk. This will bring the site back up, but it will not solve the underlying problem and you will encounter additional problems. Because open_basedir is a security setting, it's recommended to restore it to its default *after* the underlying problem is fixed.

The true problem is that your PHP app is trying to access a folder that it does not have access to any longer.

If you have WordPress, this is most often caused by a change of domain name or install location/path, but the upload_path configuration is hard-coded in the database and was not changed. 

The simplest solution is to remove the hard-coded upload_path setting which will ensure WordPress uses the default value, which typically works just fine. You can find the upload_path option in the wp_options table of your WordPress database. If you've changed your primary domain, and have additional domains in your subscription, you will need to remove the upload_path for all WordPress installs in their respective databases.

Here's how to do that:

  • Login to Plesk
  • Click 1-click web apps (or Installatron)
  • Under the app you wish to adjust, click the filesize of the "Database" to open phpMyAdmin
  • Click on the SQL tab
  • Paste in the following, then click the "Go" button
DELETE FROM wp_options WHERE option_name LIKE 'upload_path'

If you are using ModX, this issue has been encountered with the modx_workspaces setting in the database. Look for that field in the database, and update the path to its appopriate new value.]

If you disabled the open_basedir setting, you should now go back in to Plesk and restore the open_basedir PHP setting to its default.
  • 1 Users Found This Useful