All pages that have session_start() on the page have suddenly stopped loading and it’s been working for years like this. Even the host is unsure of what to do, looking for advise.
A sample test page with the following code also failed:
error_reporting(1);
if(!$_REQUEST['disable']=="yes")
{
session_start();
}
echo "hello";
If I call the page without passing the parameters ?disable=yes the page doesn’t load, it just hangs processing
The site is hosted along with 2 other sites on the server, the other 2 don’t have any issues, it’s just this one site that has all of a sudden started acting like this [no code has been changed on the site for 2+ months now].
Ok I found the issue!
And guess what, it’s not even related to sessions! Although quite surprising that mysql can cause such issues with sessions.
So what happened:
I have a master DB server and a replication slave DB set up. Most of the pages in my server were trying to connect to the slave and if the slave failed, it would connect to the master. However, for some strange reason [which I haven’t figured yet], the mysql_connect to the slave db just hung without timing out and this in turn, for some odd reason, wouldn’t allow any other page which had session_start() to load!
Now I am not sure as to why this would have such a side-effect on all other pages but I had to disable my slave server, routing all my queries only to the master and then cleared my browser cache before I could access the site again.
So a mysql_connect to a db that doesn’t work or cannot be connected to [and with the mysql_connect not timing out], it can cause issues with any other page on your server from loading – even a simple 4 line page that I have put in my question above, a page that doesn’t even call the DB.