php-fpm and nginx: session_start() failed: No such file or directory

In setting up nginx and php-fpm I uninstalled Apache (httpd) and in turn that uninstalled the standard php package that Apache uses.

In doing so this deleted some files in the /var/lib/php folder including the session folder (/var/lib/php/session). While logging into phpmyadmin it threw an error complaining about the missing folder.

It’s a simple fix, replace the session folder, making sure that the php-fpm process can read and write to it.

I had changed the user php-fpm runs as from apache to nginx to match the nginx user. This can be done in the /etc/php-fpm.d/www.conf file.

Once that’s done I ran the following to make it writable/readable by the nginx user.

# cd /var/lib/php
# mkdir session
# chown root:nginx session/
# chmod 770 session/
Advertisements

Published by:

Skyrail

Production Facilitator at Audacious Church Previously Software Developer at UKFast Ltd. and Web Applications Developer at SenseLogix Ltd. Graduate of Renewable Energy BSc from the University of Exeter. Experience with PHP, MySQL, Javascript, CSS and HTML.

Categories Linux, Operating Systems, PHPLeave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s