<p>Ok I've solved the issue. PHP was trying to save the sessions into a non-existing directory.</p>

<p>To check the current session path, I've added <code>var_dump(session_save_path());</code> in Craft's <code>/public/index.php</code> (was set to <code>/var/lib/php-fpm/session</code>).</p>

<p>Fix was to update <code>session.save_path</code> setting in the php.ini to point to the right directory with correct permission.</p>

<p>Hope this helps someone in the future.</p>

CC BY-SA 3.0
2017-11-09T16:01:53.737Z
Nice. This article may be of use to you as well, in your session spelunking. In general, I've found Redis to be a nicer solution for PHP session handling: [The Case of the Missing PHP Session](https://nystudio107.com/blog/the-case-of-the-missing-php-session)
andrew.welch
CC BY-SA 3.0
2017-11-09T16:03:08.300Z
Thanks. Yeah, Redis is the next step, but I didn't want to introduce even more variables into the equation.
Christian P
CC BY-SA 3.0
2017-11-09T15:58:15.953Z
2017-11-09T17:10:44.950Z
2017-11-09T17:10:44.950Z
Christian P
<p>When I try to log in to CP as admin with correct credentials I'm getting "Invalid username or password" error and the response contains <code>errorCode: 0</code> (I'm guessing CBaseUserIdentity::ERROR_NONE)</p>

<p>Weird part is that when I pull the same database to my local dev I can login using same credentials. </p>

<p>Only thing I can see in the logs is:</p>

<blockquote>
  <p>Tried to restore session from a cookie, but the given login name does not match the given uid. UID: bd098373-8d73-4f6c-8326-9f5a2825f5a4 and loginName: Guest.</p>
</blockquote>

<p>PHP can write into /craft/storage folder. I tried clearing out craft_session table, overridePhpSessionLocation => false and removing craft/storage/runtime/, nothing helped. </p>

<p>I'm using PHP7.1 and MySQL 5.7. </p>

CC BY-SA 3.0
2017-11-09T15:02:16.927Z
Do you have anything blocking/interfering with cookies being set in your browser?  Have you tried it from multiple browsers?
Brad Bell
CC BY-SA 3.0
2017-11-09T15:23:28.297Z
Tried it on latest Chrome and Firefox without any add-ons. In normal and private mode. Same result.
Christian P
<login>
Invalid username or password, errorCode:0 but I'm using correct credentials
# Invalid username or password, errorCode:0 but I'm using correct credentials

(Asked by: username_0 on 2017-11-09)

When I try to log in to CP as admin with correct credentials I'm getting "Invalid username or password" error and the response contains `errorCode: 0` (I'm guessing CBaseUserIdentity::ERROR\_NONE)

Weird part is that when I pull the same database to my local dev I can login using same credentials.

Only thing I can see in the logs is:

> Tried to restore session from a cookie, but the given login name does not match the given uid. UID: bd098373-8d73-4f6c-8326-9f5a2825f5a4 and loginName: Guest.

PHP can write into /craft/storage folder. I tried clearing out craft\_session table, overridePhpSessionLocation => false and removing craft/storage/runtime/, nothing helped.

I'm using PHP7.1 and MySQL 5.7.

**Tags:** login

> **Comments:**
> **username_1**: Do you have anything blocking/interfering with cookies being set in your browser?  Have you tried it from multiple browsers?  
> **username_0**: Tried it on latest Chrome and Firefox without any add-ons. In normal and private mode. Same result.  

---

## 1 answers

### Answer by username_0 on 2017-11-09. Score: 1

Ok I've solved the issue. PHP was trying to save the sessions into a non-existing directory.

To check the current session path, I've added `var_dump(session_save_path());` in Craft's `/public/index.php` (was set to `/var/lib/php-fpm/session`).

Fix was to update `session.save_path` setting in the php.ini to point to the right directory with correct permission.

Hope this helps someone in the future.

> **Comments:**
> **username_2**: Nice. This article may be of use to you as well, in your session spelunking. In general, I've found Redis to be a nicer solution for PHP session handling: [The Case of the Missing PHP Session](https://nystudio107.com/blog/the-case-of-the-missing-php-session)  
> **username_0**: Thanks. Yeah, Redis is the next step, but I didn't want to introduce even more variables into the equation.  

---

