- Knowledgebase Home
- » Browse by Service
- » (dv) Dedicated-Virtual Server
- » (dv) 3.5
- » Web Applications
- Knowledgebase Home
- » Browse by Service
- » (dv) Dedicated-Virtual Server
- » (dv) 3.5
- » Web Applications
- » PHP and Coding
(dv) Session save path errors and the vhost.conf
Overview
Session support in PHP is of a way to preserve certain data across subsequent accesses. This enables you to build more customized applications for your web site.
The /var/lib/php/session/ directory should be writable by default.
End of Life Warning
This service has a pending End of Life. Please move to a current service as soon as possible. For more information, please see: (dv) Dedicated-Virtual 4.0: Migration Information.
READ ME FIRST
This article is provided as a courtesy. Installing, configuring, and troubleshooting third-party applications is outside the scope of support provided by (mt) Media Temple. Please take a moment to review the Statement of Support.
Instructions
The default configuration on (dv) Dedicated-Virtual Servers does not allow for this if you are running PHP as a specific user (using FCGI, for example). To fix this, run the following command:
chmod 1777 /var/lib/php/session
It is also possible to fix this on a domain-by-domain basis using a special file called vhost.conf:
-
Create the new directory to house your sessions inside of your domain directory:
mkdir /var/www/vhosts/example.com/tmp
NOTE:
Replace example.com with your domain name. If this is an additional domain on the same subscription, replace example.com for the root directory for the additional domain. The default directory for an additional domain on the same subscription is site1, see Figure 1 below.

Figure 1. -
Apply the appropriate permissions and file ownership:
chown username:psaserv /var/www/vhosts/example.com/tmp && chmod 777 /var/www/vhosts/example.com/tmp -
Create the vhost.conf file in the following directory /var/www/vhosts/example.com/conf using the following command:
vi /var/www/vhosts/example.com/conf/vhost.conf -
Next, include the following line:
php_value session.save_path /var/www/vhosts/example.com/tmp -
Save the file and run this command to force Plesk to see the changes:
/usr/local/psa/admin/sbin/websrvmng --reconfigure-vhost --vhost-name=example.com -
Restart Apache to load the new changes:
service httpd graceful - Your software should now use the new path for sessions data and your CMS installation should proceed.