Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Issue with Sessions starting on PHP5.4.x

I'm experiencing an odd Sessions error that unfortunately I've been unable to reproduce locally. In my log file I'm getting the following error randomly upon viewing a page which is referring to this file

session_start(): user session functions not defined on line 84 of file /var/www/vhosts/example.com/symphony/lib/core/class.session.php

From what I can see, this Session handler looks fairly standard so I'm confused as to why this is an error?

The live environment is hosted on Rackspace and is two servers behind a load balancer running PHP 5.4.6 (PHP 5.4.6-1ubuntu1.1 (cli) (built: Nov 15 2012 01:18:34)). From what I know we have two DB servers where one is configured for writes and the other reads (by Rackspace).

My local environment is much simpler, PHP 5.4.10 with a single database, so while I think the environment may be playing a role, I'm very interested into how to fix this issue for the client foremost, but also personally, so the Session class can be made more robust.

like image 669
brendo Avatar asked May 14 '26 09:05

brendo


1 Answers

Brendo, the error that you receive when you comment ini_set('session.save_handler', 'user') is most likely caused because you do not have the PHP memcache module installed. If Rackspace configured your servers to save sessions to a memcache server, you may need to enable the PHP memcached module by modifying your php.ini file or the memcache.ini file to have session.save_handler = memcached instead of session.save_handler = memcache.

If the above does not work, you may check to see if you have either one of the PHP modules installed by running dpkg -l | grep memcache to see if either one of the PHP modules are returned.

like image 99
slade Avatar answered May 15 '26 22:05

slade