Search

Language:  
Search for:

Available article translations:

PHP on domain running via CGI/FastCGI can't use session by default

APPLIES TO:
  • Parallels Plesk 12.0 for Linux
  • Parallels Plesk 11.5 for Linux
  • Parallels Plesk 10.4 for Linux/Unix

This issue has been completely fixed since Plesk 10.4. In case if you upgrade to 11.x or 12 versions, please ignore this warning. It occurs in case if permissions on the '/var/lib/php/session/' directory are set incorrectly Upgrade in fact fixes the permissions

Symptoms

In CGI or FastCGI mode, PHP runs with the permissions of the domain's FTP user.

PHP support mode can be configured for each domain on the "Web Hosting Settings" page found at Domains -> domain.tld -> Web Hosting Settings:

Also following PHP warnings can appears:

**Warning**: session\_start() [function.session-start]: open(/var/lib/php/session/sess\_vr12g68afa365jenb96han4k24, O\_RDWR) failed: Permission denied (13) in **/var/www/vhosts/<domain>/httpdocs/<script>.php** on line **<N>****Warning**: Unknown: open(/var/lib/php/session/sess\_vr12g68afa365jenb96han4k24, O\_RDWR) failed: Permission denied (13) in **Unknown** on line 
**Warning**: Unknown: Failed to write session data (files). Please verify that the current setting of session.save\_path is correct (/var/lib/php/session) in **Unknown** on line

Cause

In Parallels Plesk Panel versions prior to 10.4, PHP configuration is set in the /etc/php.ini file and by default has the session path set as follows::
  ~# grep session.save\_path  /etc/php.ini
session.save\_path = "/var/lib/php/session"

The default permissions value for this directory is 770:

~# ls -ld /var/lib/php/session
drwxrwx--- 2 root apache 65536 Dec 16 07:48 /var/lib/php/session

~#

As the PHP scripts are processed in CGI/FastCGI mode under the <ftpuser>:psacln account, the process cannot read/write that directory and it will, effectively, pick up the session file.

Resolution

1. Upgrade Parallels Plesk Panel to version 10.4.

2. Set up customized PHP configuration for the domain.

3. Create a subdirectory under the domain's private directory:

~# mkdir /var/www/vhosts/domain.tld/private/php\_sess
~# chown &lt;ftpuser&gt;:psacln /var/www/vhosts/domain.tld/private/php\_sess
~# chmod 0700 /var/www/vhosts/domain.tld/private/php\_sess

4. Edit the customized PHP configuration file php.ini and overwrite the session.save_path directive as shown below:

~# grep session.save\_path  /var/www/vhosts/domain.tld/etc/php.ini session.save\_path = "/var/www/vhosts/domain.tld/private/php\_sess"




c81e59b61af9dca603ba03b14aabe968 9f8baf78266b4e54525d1c6bf06305a5 1d151d16e47c6f92bbf62d50eb32c4a2 56797cefb1efc9130f7c48a7d1db0f0c b44a1557287d8f5170deff96e25c511a 16524e1e2541cde3c382708b52ad207f 276b42158818c83055d6dfa6371d4e4b 1bb40a2897c5fbbe5c9bd20451105ddc 824237ce663843af86f93897fbd8e2f8

FEEDBACK
Was this article helpful?
Tell us how we may improve it.
Yes No
 
 
 
 
 
 
Desktop Virtualization
- Parallels Desktop 9 for Mac
- Parallels Transporter
- Parallels Desktop Switch to Mac Edition
- Parallels Desktop for Mac Enterprise Edition
- Parallels Management-Mac for Microsoft SCCM
Server Virtualization
- Parallels Cloud Server
- Parallels Containers for Windows 6.0 Beta
- Parallels Virtuozzo Containers
Automation
- Parallels Automation
- Parallels Automation for Cloud Infrastructure
- Parallels Business Automation Standard
- Parallels Virtual Automation
- Parallels Plesk Panel Suite
- Web Presence Builder
- Parallels Plesk Automation
- Parallels Small Business Panel
- Value-added Services for Hosters
- Parallels Partner Storefront
Services & Resources
- Cloud Acceleration Services
- Professional Services
- Support Services
- Training & Certification