I am often hired as a PHP programmer to repair WordPress installations. Frequently, it’s fixing a hacked website infected with malware. Sometimes is code or configuration problems. Today I was hired to fix a problem with the WordPress admin.
The client said they were seeing “Too many redirects” error when trying to login to the WordPress dashboard. Taking a quick look I could see that the admin url was stuck in a redirect loop. After asking the client about any recent site changes or updates I got to work.
After checking all of the usual reasons that may cause this problem, and not finding a solution, I had to start thinking outside the box a bit. I saw there were error logs on the server, so I opened them up.
The log was full of this error:
PHP Fatal error: Directive 'allow_call_time_pass_reference' is no longer available in PHP in Unknown on line 0
Not something you see to often.
I found a old,dated php.ini file in the admin directory and reviewed it. I found a reference to allow_call_time_pass_reference and commented it out. Error gone. Watching the error log and viewing a few more pages, I saw some other similar errors. I ended up removing the php.ini file and then attempted to log into admin again. BINGO! These errors were the source of the problem.
This is what makes debugging code errors “fun”. Things aren’t always what they seem. The solution to this problem is not something you will find in a book. Most likely Googling it is not going to help you find a solution either. This issue was due to outdated code because the website was not regularly maintained. The web host must have done a server upgrade and changed the PHP configuration.