I have Craft running locally, the latest 2.x branch. When I change the server to run PHP 7 instead of 5.x, the local Craft frontend still works, but I can't login to the backend. It says "Invalid username or password", even after doing the reset password process.

Trying to prep a site for upgrading to Craft 3, but if I can't even get Craft 2.x running on PHP 7... :-/

  • 1
    Any change you are running PHP 7.2? – Gįëł Tėttëłæår Apr 9 '18 at 13:12
  • I was, but saw the incompatibility note in the docs and so switched to 7.1. No difference—not even via password reset. – Sandwich Apr 9 '18 at 13:14
  • If you have access to the mysql db - enter the following values for the user you are trying to access: -- USERNAME: 'admin' || PASSWORD: '$2a$13$5j8bSRoKQZipjtIg6FXWR.kGRR3UfCL.QeMIt2yTRH1.hCNHLQKtq'; If that doesnt work you will probably have to look at the logs and see what errors are being thrown -- the password phrase to use will be 'password' – Gįëł Tėttëłæår Apr 9 '18 at 13:19

Turns out that it was a PHP configuration issue.

Under Windows, the paths in php.ini need to include a drive letter (eg. c:\xampp\php7\). By default they're root-relative (eg. \xampp\php7). When I originally installed XAMPP with PHP 5.x, it adjusted the paths automatically. But when I manually copied the PHP 7 folder into XAMPP to set it up for version switching, I overlooked the path discrepancy.

In this case, it was the inability of PHP 7 to set sessions that was causing the odd behavior.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.