Resolve SugarCRM “You have been logged out because your session has expired”

October 24th, 2011 - Posted by Steve Marks to Server Management, Software, Web Development.

Upon trying to login to SugarCRM ealier today I kept getting an error stating “You have been logged out because your session has expired”. I knew the details were correct but no matter how many times I tried the same message kept coming up and I could not login. Upon fumbling around for a while I came across a couple of solutions, one of which resolved the problem. I explain these in more detail below:

Solution One – Session Directory Not Writable

This first solution wasn’t relevant in my case but I did see it mentioned a few times on my travels as a very likely resolution to the problem mentioned above and thought it worth a mention it here.

When you’re logged into SugarCRM it uses PHP sessions to store information about your current visit. This solution suggests that the directory where this session information is stored is not writable and therefore SugarCRM is unable to continue past the login screen.

So where is this directory? The first place to look is in your SugarCRM configuration file. This can found in the root of your SugarCRM installation and is in a file called config.php. Within this PHP file is a reference to where sessions will be stored. If this contains a valid path then ensure SugarCRM has permission to write to it.

If the above path in config.php is blank then SugarCRM will use the path set in the php.ini file. You can view what this is set to by creating a PHP file and entering the following:

echo ini_get("session.save_path");

Solution Two – Disk Out Of Space

The other possible cause of the error was that the disk where SugarCRM is located was out of space which was the case in my scenario. By simply deleting a few old backups and cleaning down unused files I was then able to login again immediately.

This entry was posted on Monday, October 24th, 2011 at 9:23 pm by +Steve Marks and is filed under Server Management, Software, Web Development. You can follow any responses to this entry through the RSS 2.0 feed.
Comments...

Fear not, we won't publish this

Comments (3)
  1. In my case, I migrated from apache to nginx and had to change group to nginx on /var/lib/php/session to resolve this issue.

    Thanks

  2. Thanks! This post led me to my answer, which is a variation of the two scenarios you pointed out. Seems you’ll ALSO get this message when you don’t ever purge your PHP session folder and it ends up with an excessive number of sess_* files. Not enough to fill the drive, but enough to cause issues working in the folder. I’d give you a ball park number of how many I found on my problem server, but I can’t seem to find a tool that can count them all in a reasonable time period. Now that I’ve started deleting them, I can log in again. Thanks again!

  3. Marco says:

    Cheers man, I was desperate for an answer to this problem. Without this I would have needed to configure sugarCRM from scratch on my new server, which would have taken ages!