Search

Search for:
Language:  

No categories for selected product

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

Article ID: 7056 
Last Review: Apr, 16 2012
Views:
APPLIES TO:
  • Parallels Plesk Panel 10.x for Linux
  • Parallels Plesk Panel 9.x for Linux/Unix

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 0
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 0

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/vhost/domain.tld/private/php_sess
~# chown <ftpuser>:psacln /var/www/vhost/domain.tld/private/php_sess
~# chmod 0700 /var/www/vhost/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"





Email subscription for changes to this article Email subscription for changes to this article

Please provide feedback on this article

* Did this article help you solve your issue?
Yes
No
What can we do to improve this article?

PLEASE NOTE: Knowledge Base feedback is reviewed occasionally and we do not reply to most of the individual comments. Please contact us using one of the Support channels for a response to any support inquiries. We appreciate your feedback.

Subscribe me for article updates. My email
 
 
 
 
 
 
For Home
For Hosters
For SaaS
For IaaS
For Developers
For Health Care
 
Desktop Virtualization
- Parallels Desktop 7 for Mac
- Parallels Transporter
- Parallels Mobile
- Parallels Desktop Switch to Mac Edition
- Parallels Workstation
- Parallels Workstation Extreme
- Parallels Desktop for Mac Enterprise Edition
Server Virtualization
- Parallels Server for Mac 4.0
- Parallels Server for Mac 4.0 Mac mini Edition
- Parallels Server for Mac Bare Metal Edition
- Parallels Server Bare Metal
- Parallels Virtuozzo Containers
Automation
- Parallels Operations Automation
- Parallels Automation for Cloud Infrastructure
- Parallels Business Automation
- Parallels Business Automation Standard
- Parallels Virtual Automation
- Parallels Plesk Panel Suite
- Parallels Small Business Panel
- Parallels Domain/SSL Reseller Program
- Parallels Partner Storefront
More Products