# CakePHP 3.5 with PHP7.1 - Login Issue

**URL:** <https://discourse.cakephp.org/t/cakephp-3-5-with-php7-1-login-issue/3855>\
**Category:** Need Help\
**Created:** [February 2, 2018, 3:52am UTC](https://discourse.cakephp.org/t/cakephp-3-5-with-php7-1-login-issue/3855 "2018-02-02T03:52:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![CCorreia](https://avatars.discourse-cdn.com/v4/letter/c/a88e4f/32.png) [@CCorreia](https://discourse.cakephp.org/u/CCorreia)\
**Post date:** [February 2, 2018, 3:52am UTC](https://discourse.cakephp.org/t/cakephp-3-5-with-php7-1-login-issue/3855/1 "2018-02-02T03:52:23Z")

</div>

At my company we’ve recently moved from PHP 5.2 to PHP 7.1 and for the most part it went perfectly, but recently we’ve found an issue that the login for our backoffice is doing a number of redirects to the login page. After a bit of digging we noticed that by using the $this-\>Auth-\>setUser($user) it will renew the session by using the ( Function renew in the Session class ).

So for PHP 7 there’s reported issue with the session\_regenerate\_id ([https://bugs.php.net/bug.php?id=70871](https://bugs.php.net/bug.php?id=70871)).

What I get while debugging is this:  
_session\_regenerate\_id(): Failed to create(read) session ID: user (path: /var/lib/php/mod\_php/session) [CORE/src/Network/Session.php, line 576]_  
_session\_regenerate\_id - [internal], line ??_  
_Cake\Network\Session::renew() - CORE/src/Network/Session.php, line 576_  
_Cake\Controller\Component\AuthComponent::setUser() - CORE/src/Controller/Component/AuthComponent.php, line 613_

Not sure if relevant but we are using database sessions.

What I think it’s happening is that after the user gets identified and set it’s not really as it redirects back to the login page but I was wondering if you had any idea how to workaround this issue?

Thanks
