No longer able to login to FreePBX Administration

I’m running FreePBX on CentOS 6.8
Last week I upgraded my PHP from 5.3 to 5.6 for some other stuff I run on my server and since then I’m unable to login to the admin web interface.
I get to the admin login page and enter my credentials but I get the following message in red
Please correct the following errors:
Invalid Username or Password

I’m very sure I’m entering the correct credentials and have even copied and pasted them from the amportal.conf file (the AMPMGRUSER and AMPMGRPASS variables) which are what I know the correct credentials to be.

The apache logs do not show any errors. The only log I see any form of error is in freepbx_security.log and I get the following 3 lines

[2016-09-26 14:11:09] {“username”:“admin_user”,“extdisplay”:false}
[2016-09-26 14:11:09] Authentication failure for admin_user from
[2016-09-26 14:11:09] Possible proxy detected, forwarded headers foradmin_user set to

I have a VM running CentOS 6.8 but still PHP 5.3 and have upgrade my test FreePBX to the same (latest) and am still able to login the admin interface so I’m pretty sure it’s not FreePBX at fault here but rather something to do with the PHP upgrade but I don’t know where to look.
I have put my php.ini file 5.3 back, and restarted apache and fwconsole restart but that hasn’t helped.

Anyone have any ideas that I can look at, please?


Use the instructions here for fwconsole unlock

Update FreePBX modules, then reset the admin password with Admin, Administrators.

Thanks for the reply, it certainly looks promising but I seem to be having issues.

The first time I ran the fwconsole unlock I got the following back (I had purged my browser cache and refreshed the page to get a new session ID)

fwconsole unlock 271apa99q7g4v25urqoqdt7ch6
Unlocking: 271apa99q7g4v25urqoqdt7ch6
Session Should be unlocked now
Whoops\Exception\ErrorException: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/lib/php/session) in file Unknown on line 0
Stack trace:

  1. () Unknown:0

so I had a look at the session directory and figured it may be a permission issue.
The session directory was the default as /var/lib/php/session and is owned by apache.
My FreePBX runs as user asterisk (set in the httpd conf file for the v-host), I run multiple other websites on this server so most run as user apache.
I added “php_value session.save_path “/tmp/php/session/freepbx”” to the v-host conf file for FreePBX and created the directory structure, set directory owner to asterisk and reloaded apache.
I purged my browser cache and cookies again and refreshed the page and got a new session ID and I could see the session file in /tmp/php/session/freepbx

When I then ran the unlock I got the following

fwconsole unlock 271apa99q7g4v25urqoqdt7ch6
Unlocking: 271apa99q7g4v25urqoqdt7ch6 Failed, Invalid session

I tried a few things with permissions on the /tmp/php/session/freepbx directory but nothing helped.
I also removed the session.save_path from the v-host conf for FreePBX so it would revert back to the default /var/lib/php/session and reloaded apache, cleared browser cache and cookies and refreshed and saw the new session created in /var/lib/php/session but all I still get is that “Failed, Invalid session” message

My FreePBX modules are currently up to date

fwconsole moduleadmin showupgrades
No repos specified, using: [extended,standard] from last GUI settings

Up to date.

I must be missing something but I don’t know what else to try now…

an update…

I am now able to login to the admin interface using my normal admin account I always used.
I found this topic
which mentions the admin account going missing so I looked at the database on my live server and compared some tables to my VM (which still works as it updated from before the mentioned troubled framework version to the fixed one) and found the ampusers table on my live was missing the admin account.
I manually added the admin account back into the database using the values (the hashed password mainly) from my VM as it was a copy of my live and now I can login again.

I do still, however, have the issue with fwconsole unlock not working so if anyone has any ideas I’d be keen to know to try get this working for the future as it certainly could be useful.

There was something here yesterday or the day before about session information being stored in a non-standard directory. Since you are working on the upgrade of PHP from 5.3 to 5.6, double check your PHP_Session directories and make sure that the system and you are in agreement about where those session information files should be.