Applicable to:
- Plesk for Linux
- Plesk for Windows
Symptoms
-
A website is not accessible with one of the following errors in a web browser:
404 file not found
500 Internal Server Error
Error 500 move_uploaded_file(): open_basedir restriction in effect. File(/path/to/the/directory) is not within the allowed path(s): (/var/www/vhosts/example.com/:/tmp/)
No input file specified.
-
The following error message appears in the domain's Logs page (Domains > example.com > Logs):
<...> open_basedir restriction in effect. File(/path/to/the/directory) is not within the allowed path(s) <...>
Uncaught Exception: Session: Configured save path '/path/to/the/directory' is not a directory, doesn't exist or cannot be created.
Cause
The PHP script is trying to access the folder for which access is not allowed. This restriction is defined by the PHP open_basedir
variable for each domain separately. By default, open_basedir
allows access to the tmp and domain's document root directories, as well as the system's default sessions path.
Resolution
-
Go to Domains > example.com > PHP Settings.
-
Add the path from the error message to the
open_basedir
field:-
on Linux
Below is an example for the directory /path/to/the/directory:
{WEBSPACEROOT}{/}{:}{TMP}{/}{:}/path/to/the/directory
-
on Windows
Below is an example for the directory
E:\path\to\the\directory\
:{WEBSPACEROOT}{/};{TMP};{/};"E:\path\to\the\directory\"
-
-
Apply the changes.
Note: The default session.save_path for Linux is (RedHat-based) /var/lib/php/session/
or (Debian-based) /var/lib/php/sessions/
, and for Windows is C:\Windows\Temp
Comments
11 comments
Does not seem to work
@Kingsley Felix
Hi,
What error do you have? and what exactly are you trying to do to fix it?
Hi not work for me.
New error:
Message: is_dir(): open_basedir restriction in effect. File(/var/lib/php/sessions) is not within the allowed path(s): (/var/www/vhosts/hdszex.hu/:/tmp/:/var/lib/php/session)
Message: mkdir(): open_basedir restriction in effect. File(/var/lib/php/sessions) is not within the allowed path(s): (/var/www/vhosts/hdszex.hu/:/tmp/:/var/lib/php/session)
The problem with the chmod session path, I change 777 and now work.
I have followed the guidelines but the problem persists. please help me
forum thread: https://talk.plesk.com/threads/error-help-open_basedir-restriction-in-effect-file-var-lib-php-sessions-is-not-within-the-allowed-path-s.355992/#post-875505
Hello @Nagy Bela
Glad to hear that the issue resolved on your own. The default permissions for /var/lib/php/sessions are 733
Hello MAXsi Jaya!
Please, correct me if I'm wrong but as I understand, the issue is resolved at the forum.
@Bulat Tsydenov
Hi,
I have follow all above setting but still it is showing open_basedir restriction.
PHP Warning: opendir(): open_basedir restriction in effect. File(C:\ZFT\) is not within the allowed path(s):
@Abhishek Savner,
I'd recommend contacting our Support Team, so they may check the issue thoroughly.
Its not working , as usual poor quality from Plesk team!!!!
Hello, eamon
In case you think the steps taken were correct and the error persists, you can submit a support request here:
https://support.plesk.com/hc/en-us
Please sign in to leave a comment.