Sarcasm was also my first thought on this one, then I thought I'd tell the world how I handle it !

For one of my sites there are two solutions implemented to two situations (that's two solutions in total, not four :)).

1) User is already in site, and makes another request.
Load up a very small js with the site. When the request times out, this script either pops an error message or redirects the requests to the failover.


2) User is trying to get to the site for the first time.
The domain is actually pointed to a GSLOB (load balancer). This continually polls both primary and secondary (and tertiary...) sites and directs traffic to whichever has the lowest load, or to whichever site the rules are set to.
This is of course a more expensive solution that may not be at all applicable in your instance (expense is the purchase and hosting of the load balancer hardware).


Tom

Jay Blanchard wrote:

[snip]
I want to write a script that will check if the server is down if it is
I want to redirect the user to another site, the backup server.


Similarly I want users who go on to the seondary site when the main
server is UP to be redirected to the main site.


Can this be done using PHP. If not can you point me in the right
direction?

Kind regards,
[/snip]

So I'm on this server at this URL right? And the HTTP server is down,
right? The script would have to be aware of an HTTP request, right?


Let us say I am on http://foo.com and I click a link or enter an address
for http://bar.com . If the server is down that is hosting
http://bar.com .... well, I think you see where I am going.

Now, you could requests to port 80 maybe. And PHP CLI could be set in a
loop to handle the request, but this may be a really bad plan. You would
probably want some sort of port sniffer to monitor the port for
activity.




-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to