Website redirect when php is down

Soldato
Joined
30 Mar 2004
Posts
9,732
Location
London
Is there any way to get a site to redirect if, say, php is down on the webserver and causing connections to time out?

We currently have our homepage set to our website, which is Joomla-based and uses PHP. On a couple of occasions, php has gone down on our (hosted)webserver, causing connections to the website to timeout. Other items on the webserver, such as an archive of our old website (which does not use php) still work fine when this happens.

The problem is, as our homepage is set to our website, when this happens everyone thinks that our internet is down and bombards support with calls.

Is there any way that a check could be performed when connecting, to see if the php site is working OK? Opening up the php website when it's OK and redirecting to another page when it's not?
 
PHP doesn't go down - you're probably seeing a connection timeout to your database which could be for a few reasons. Ask your host :)
 
It's not a database connection. A simple info.php file will not load either, whilst all other resources remain accessible. It's just all things php that go to pot.

This is on a Windows webserver, rather than Apache. I normally log a call and following a reboot of our server it all works fine, but this normally takes half a day.
 
Hmm could you maybe use Javascript to automatically try and connect to a php file AJAX style and if it doesn't get the response it's expecting redirect?
 
I'll see if I can work something out in Javascript.

It is really weird when it happens. I'm guessing it's something to do with IIS.
 
That's unacceptable - tell your host so. Of course if it's an unmanaged dedicated it's down to you...but still it shouldn't take more than 20 minutes to get a system rebooted.

Check IIS's status at the time the problem happens - perhaps its connection limits need increasing. Try using FastCGI too :)
 
I've had all sorts of issues with running PHP on IIS. Stick with Apache if you can.
 
It's happened again today. Example error:

"Fatal error: Maximum execution time of 30 seconds exceeded in E:\inetpub\vhosts\*****\httpdocs\modules\mod_ccy\mod_ccy.php on line 19"

It seems that something slows PHP responses down so much that it just times out. I could increase the response time in the php config, but responses simply shouldn't be taking this long.

Absolute pain.
 
Last edited:
What about if you put your whole page inside a frame and make an ajax call to the page. If it returns anything other than 200, display something else in the frame.
?
 
What about if you put your whole page inside a frame and make an ajax call to the page. If it returns anything other than 200, display something else in the frame.
?

Interesting idea. I'll have a play with it.


For those interested, the host is Synetrix. They provide is with a decent 100Mb internet connection, but the windows IIS webserver is rather annoying to say the least.
 
Get your host to fix it. There's really no point trying to work around it, it's unacceptable and I would move hosts rather than try and work with such an arrangement.
 
Back
Top Bottom