|
Posted by Gordon Burditt on 12/28/05 09:20
>Thank you for taking the time to write out these superb explanations; I
>and I'm sure others appreciate it. Just a few more question, if I
>may...
>
>1. How does the browser know that it should translate
It doesn't. The WEB SERVER translates. The browser should not
have access to this information (and I would consider it a security
problem), nor does it need it.
>http:/localhost/myFile.html into /var/www/html/myFile.html? Is there an
>ini file somewhere that contains this information?
You configure a web server for a document root (that's what Apache
calls it. You can run Apache on Windows. On UNIX, this is probably
set in httpd.conf or a file included by it.). The document root
and its subdirectories contain the web pages to serve. IIS certainly
has a similar concept that you can configure somewhere. I don't
do Windows so I have no idea where this is.
>2. This thread got started because the first mysql call (see below)
>failed, but when I changed localhost to 127.0.0.1, as in the second
>call, it worked. Given the information I have from you now, I don't see
>how the first call could ever work, although the documentation says
>that it should. Any ideas?
MySQL (specifically, the client library) uses local UNIX-domain (at
least on UNIX) sockets (created by the server) when you connect to
"localhost". (This string is recognized specially, whether or not
looking it up in the hosts file yields "127.0.0.1" for the IP
address.) This will have problems if your MySQL client (e.g. PHP)
and your MySQL server (mysqld) disagree over the location of the
socket. The fix here is to get them to agree on the location of
the socket (may be fixable in php.ini).
MySQL uses Internet-domain sockets when you connect to an IP address.
There is no issue of the path name to a socket that can be
misconfigured: you don't get to specify one, and there may not be
any such socket on the local MySQL client machine (the one running
PHP and the web server).
>$conn = mysql_connect("localhost", "root", ""); // This fails.
>$conn = mysql_connect("127.0.0.1", "mike", ""); // This works.
Gordon L. Burditt
[Back to original message]
|