Applicable to:
- Plesk for Linux
- Plesk for Windows
Symptoms
-
Domain with WHMCS shows error:
PLESK_INFO: The PHP session save path /var/lib/php/session is not writable. Please investigate the session.save_path PHP setting or contact your system administrator.
PLESK_INFO: Warning: session_start(): open(C:\Windows\Temp\sess_udfqa0si9tsg9i89dhene7ms78, O_RDWR) failed: Permission denied (13) in C:\inetpub\vhosts\example.com\includes\connect.php on line 2
-
Permissions for the folder mentioned in the error are correct:
# ls -la /var/lib/php/
...
drwx-wx-wt 2 root root 4096 Nov 15 23:36 session
C:\> \Users\Administrator>icacls C:\Windows\Temp
C:\Windows\Temp\ NT AUTHORITY\NETWORK SERVICE:(CI)(RX,D,WD,AD)
HOSTNAME\PP_WPG:(CI)(RX)
HOSTNAME\psaserv:(CI)(RX)
HOSTNAME\psacln:(CI)(RX)
HOSTNAME\psaadm:(CI)(RX)
HOSTNAME\psaadm:(OI)(IO)(R)
BUILTIN\Users:(CI)(S,WD,AD,X)
BUILTIN\IIS_IUSRS:(OI)(CI)(S,RD)
CREATOR OWNER:(OI)(CI)(IO)(F)
NT AUTHORITY\SYSTEM:(OI)(CI)(F)
BUILTIN\Administrators:(OI)(CI)(F)
Cause
Subscription system user directory for sessions is not created or it is not set in the session.save_path PHP settings.
Resolution
Note: in case there is no WHMCS installed on the same server, refer to the following article: Website hosted in Plesk displayed incorrectly or showing the PHP warning: Failed to read session data: files
It is required to create a special directory for the PHP sessions. It is possible to do it via SSH (for Linux) or via Plesk UI (for both Linux and Windows).
-
Open File Manager under Domains > example.com.
-
Click New and choose Create directory.
-
Specify some name for the folder in this case we call it phpsessions.
-
Go to the PHP-Settings under Domains > example.com.
-
Change the setting session.save_path to the total path of a created folder:
CONFIG_TEXT: /var/www/vhosts/example.com/phpsessions
CONFIG_TEXT: C:\inetpub\vhosts\example.com\httpdocs\phpsessions
-
Connect to the server using SSH;
-
Execute the following commands, instead of example, insert subscription system user name:
# mkdir -p /home/example/whmcsdata/sessions
# chmod 1750 /h /home/example/whmcsdata/sessions
# chown example:psacln /home/example/whmcsdata/sessions -
Log into Plesk;
-
Navigate to Domains > example.com > PHP settings;
-
Set the following directives, for example (for PHP 7.0) and click OK to apply the change:
CONFIG_TEXT: include_path: ":/opt/plesk/php/7.0/share/pear:/home/example/whmcsdata/sessions"
session.save_path: ":/home/example/whmcsdata/sessions"
open_basedir: ":{WEBSPACEROOT}{/}{:}{TMP}{/}:/home/example/whmcsdata/sessions"
Note: The path needs to be writable for the app pool user
Note: The directory in question does not belong, or is created by WHMCS plugin developed by Plesk, but by the WHMCS platform. Please contact WHMCS technical support at https://www.whmcs.com/support in case root cause analysis is required.
Comments
15 comments
For me this is not working....
@Alexander Rieder
Hello!
Could you share some additional information? Was the initial error identical to the error in the article? Did the behavior remain the same after resolution or different error appeared?
Hi,
Unfortunately it is also not working for me. I am just getting a login loop on WHMCS and it does not allow me in.
@Gert
Hi, are you getting the same error? Can you share it in full?
@Alexandr
Hi,
I found the problem. In the Resolutions provided the text states to use:
open_basedir: ":{WEBSPACEROOT}{/}{:}{TMP}{/}{:}/home/example/whmcsdata/sessions"
However the screenshot shows the following:
open_basedir: ":{WEBSPACEROOT}{/}{:}{TMP}{/}:/home/example/whmcsdata/sessions"
No {:} but only :, I just removed the { } and problem sorted.
@Gert, thanks for info!
So the right working path for you is open_basedir: ":{WEBSPACEROOT}{/}{:}{TMP}{/}:/home/example/whmcsdata/sessions" ?
If yes, the screenshot is right.
Yes, the screenshot is correct.
Create a sessions path in the root of your webspace, same place you have your temp and templates_c directories, and set it this way:
include_path: ":/opt/plesk/php/7.0/share/pear:{webspaceroot}{/sessions}"
session.save_path: "/var/www/vhosts/yourdomain.com/sessions" (Notice there is no colon in the beginning)
open_basedir: ":{WEBSPACEROOT}{/}{:}{TMP}{/}:{webspaceroot}{/sessions}"
Tested working here:
Version 17.8.11 Update #5, last updated on April 15, 2018 02:48 AM
@Marcos, thanks for sharing!
@Marcos, thank you! It helped a lot!
Hello, this is not work for me.
Solution that work for me:
include_path: :/usr/share/pear:/usr/share/php
session.save_path: /tmp
open_basedir: {WEBSPACEROOT}{/}{:}{TMP}{/}
Hello / Hola.
I have tried with all the configurations that I have seen here, changed the permissions, changed the routes of the session modifications, installed new versions and obsolete versions of php, modified the php.ini and none of them worked for me... What could it be happening? I do not know what else to do...
Hello / Hola.
I have tried with all the configurations that I have seen here, changed the permissions, changed the routes of the session modifications, installed new versions and obsolete versions of php, modified the php.ini and none of them worked for me... What could it be happening? I do not know what else to do...
Hi Marcos, I also have the same problems, I followed your advice:
include_path: ":/opt/plesk/php/7.0/share/pear:{webspaceroot}{/sessions}"
session.save_path: "/var/www/vhosts/yourdomain.com/sessions" (Notice there is no colon in the beginning)
open_basedir: ":{WEBSPACEROOT}{/}{:}{TMP}{/}:{webspaceroot}{/sessions}"
and its working perfect now, awesome man, thank you!
The solution was helpfull straightforward and it was usefull,
I did just that changed the line in php.ini to semicolon to just disable it but not deleted...
; session.save_path = "/var/lib/php/sessions"
than added the one recommended with plesk for linux
session.save_path = "/var/www/vhosts/example.com/phpsessions"
but the error persists, than i changed
session.auto_start = 0
to
session.auto_start = 1
and now the error message in WHMCS is
PHP session support is enabled.
Session autostart is enabled. This will prevent WHMCS from remembering user logins. Please disable the session.auto_start PHP setting.
The PHP session save path /var/www/vhosts/example.com/httpdocs/phpsessions is writable.
than reverted php.ini to
session.auto_start = 0
and voilá!
Please sign in to leave a comment.