Plesk is not accessible: open_basedir restriction in effect. File is not within the allowed path(s) Print

  • 2

Applicable to:

  • Plesk for Linux
  • Plesk for Windows

Symptoms

  • A website is not accessible with one of the following errors in a browser:

    PLESK_INFO: 404 file not found

    OR

    PLESK_INFO: 500 Internal Server Error

    OR

    PLESK_INFO: Error 500 move_uploaded_file(): open_basedir restriction in effect. File(/var/www/any/path/to/the/directory) is not within the allowed path(s): (/var/www/vhosts/example.com/:/tmp/)

  • In Plesk for Linux, one of the following error messages appears in domain's error logfile /var/www/vhosts/example.com/logs/error_log:

    CONFIG_TEXT: A PHP Error was encountered
    Severity: Warning
    Message: is_dir(): open_basedir restriction in effect. File(/var/lib/php/session) is not within the allowed path(s): (/home/www/vhosts/example.com/:/tmp/)

    OR

    CONFIG_TEXT: Got error 'age: PHP Warning is_dir(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (/var/www/vhosts/example.com/:/tmp/) in /var/www/vhosts/example.com/httpdocs/wp-includes/functions.php on line 1613\

  • In Plesk for Windows, the following error message appears in domain's error logfile %plesk_vhosts%example.com\logs\php_errors\example.com\php_error.log:

    CONFIG_TEXT: PHP Warning: Unknown: open_basedir restriction in effect. File(E:\custom_folder\sessions) is not within the allowed path(s): (C:/inetpub/vhosts/example.com\;C:\Windows\Temp\) in Unknown on line 0

In some cases:

  • The phpinfo() page launched at Domains > example.com > PHP Settings > View the phpinfo() page is not accessible:

    PLESK_ERROR: Unable to retrieve information about the PHP configuration

  • Logfile size quickly increases:

    # find /var/www/vhosts/system -size +1G -exec ls -lh {} \;
    -rw-r--r-- 2 root root 218G 1. Jun 11:27 /var/www/vhosts/system/example.com/logs/error_log

Cause

PHP script is trying to access the folder for which access is not allowed. This restriction is limited by the PHP open_basedir variable for each virtual host separately. By default, open_basedir is set to allows access for PHP files to the tmp and httpdocs directories.

Resolution

Note: If you are a domain owner and the open_basedir setting is not available for you, please contact your service provider for assistance.

Adjust the value of open_basedir in order to include missing path from the error message:

  1. In Plesk, go to Domains > example.com > PHP Settings.

  2. Modify the value of open_basedir:

    • For Linux

      Below is an example of including the directory /var/lib/php/session to open_basedir:

      CONFIG_TEXT: {WEBSPACEROOT}{/}{:}{TMP}{/}{:}/var/lib/php/session

    • For Windows

      Below is an example of including the directory E:\custom_folder\sessions to open_basedir :

      CONFIG_TEXT: {WEBSPACEROOT}{/};{TMP};{/};"E:\custom_folder\sessions\"


Was this answer helpful?

« Back