Invalid username or password, errorCode:0 but I'm using correct credentials 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.
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.