View Single Post
Posts: 9 | Thanked: 1 time | Joined on Mar 2010
#225
Originally Posted by x-lette View Post
No, you said, you'd recommend this way. Everybody can use the IP of the server where the site is hosted, but not for everyone this makes sense.
Actually, the question is not trivial.

To start with, we are in agreement, but you seem to misunderstand the following:

If you can, I would recommend using the IP...

There is an implication by stating "If you can" that what follows will not be suitable for all cases. Of course it is true that for all cases an IP can be used to just test the server and it goes without saying that it can be done.

What cannot be done by using the IP is as you stated, when using name based virtual hosting - which is why I refer to the status response as being important, since my script will give a different error response for the following conditions:

1. server cannot be resolved, server is down or server is up, but nothing from the appropriate port.
2. conditions which may indicate a running server but no website. maybe your account has been blocked returning a file not found.

I am with Bluehost and there 2 things I will note here, 1, I will need to modify the script further to get the result because they will block your account by simply placing a different .htaccess file in your folder if there is a potential cross site script problem with any php they know of as a security risk. updating the php code will have the site unblocked.

2. It costs an extra dollar a month to have your own IP. I can operate personal services on incoming ports.

This script will pause the entire desktop whilst running, so avoiding a name lookup is quite appropriate, an alternative solution is add your host to the /etc/resolv.conf and this will allow name based hosts to be checked more quickly.

I tried to make my solution as generic as possible, so only people who know about virtual hosts would know what they need to use. Those who don't know may or may not care that its just the physical server that is being checked and therefore may prefer the speed of an IP check

For those who know what they are looking for, they can of course modify this or write their own.

I thought your original comment was useful, to help clarify.

Neither of us was wrong though.

orac.