1

I've migrated my client's Craft site to a new host. On the front end the site is fine and working as it should.

The problem is with the Craft admin area. I can login, but once logged I can’t access anything other than the main dashboard screen. Clicking any of the links within the dashboard brings up the login screen.

One thing I did try was to remove the cpTrigger I’d set in /craft/config/general.php. For a moment I thought this had worked. I could access other areas of the dashboard, but then the dashboard logged me out after a minute or so.

I’ve seen a few other posters with similar issues and have tried solutions that worked for them…

I’ve delete the contents of craft/storage/runtime.

I’ve checked the file permissions of craft/storage/runtime. They are currently set to 774.

I’ve tried adding the following to craft/config/general.php:

'overridePhpSessionLocation' => false As described here - Craft constantly logging out from admin area

and also:

'overridePhpSessionLocation' => true

As described here - Migrated Server, Now Getting Logged Out Constantly

I’ve tried 'requireMatchingUserAgentForSession' => false too.

Nothing has worked so far.

Is there anything else I could try?

I understand this is likely to be related to permissions for where session files are stored. Are there any questions I should be asking the the hosting company in relation to this? The site is on a shared hosting account.

Any help or advice with this much appreciated.

* An update... *

I looked at /admin/utils/phpinfo in the dashboard to check where session.save_path is pointing.

By default it's set to /tmp.

If I add 'overridePhpSessionLocation' => true to craft/config/general.php, the session location is set to:

/var/www/vhtdocs/xxxxxxxx/craft/storage/runtime/sessions/
/tmp

That looks a bit odd to me? There are two paths – the craft path and the default session path below it. Is that correct?

Dan B
  • 21
  • 4
  • Re: your update, that's normal. The first value is the application's current value (Craft), the 2nd is the default global value. It's more clear if you call phpinfo() from a script directly. – Brad Bell Nov 21 '17 at 16:41

4 Answers4

1

Just a question; are you on a Nginx server? I had a similar issue before with a client site. the Nginx configuration was removing the cookies when it cached the page, which redirected to the login page after logging in.

lpbouvier
  • 17
  • 2
  • I'm not sure if it's an Nginx server or not. I'll contact the hosting company and find out. – Dan B Nov 21 '17 at 15:03
1

I'm not sure if 774 would be enough permissions on that folder. If the web server is not running as the account user (via ruid or suexec/suphp), or is not in the same group as the account user then it will not be able to write to it. Just throwing it out there.

Rick Kukiela
  • 632
  • 5
  • 16
1

Sounds to me like a server config issue. The site worked in one place, you moved it, and now you have this issue.

If it's an Nginx server, this may be helpful: Nginx-Craft

andrew.welch
  • 11,551
  • 22
  • 31
  • I'll contact the hosting company to see if they can help with regards to the server config. I'll find out if it's an Nginx server too. – Dan B Nov 21 '17 at 15:07
1

I contacted the hosting company and they managed to fix the issue. They whitelisted the cookie name in their varnish caching system.

Dan B
  • 21
  • 4