2

I've successfully used PHP/Apache/MySQL on my iMac several times in the past few months/years. However, I started using a new PHP book and moved things around a bit (obviously without knowing what I thought I was doing!) I managed to get localhost working about a week ago. I had to stop work on this project until late today. Once again, using a saved bookmark for phpMySql today, I got the infamous "cannot connect to localhost." message.

To make this somewhat shorter, I can now access localhost again. Whew! Here's my hosts file:

10.0.1.2    localhost
255.255.255.255 broadcasthost
::1             localhost
# fe80::1%lo0   localhost

Firstly, I have no idea what that last, commented out line is for, but I'll search the net after posting this.

Secondly, the 10.0.1.2 used to appear in the "Web Sharing" Pref Panel. Now it has my computerName/~username.

Finally, although localhost is working (and I changed the bookmark for it), apachectl -t shows this response:

httpd: Could not reliably determine the server's fully qualified domain name, using ::1 for ServerName

I thought from reading that this indicated the use of IPv6 but turning that OFF in Network PP doesn't seem to make any difference in the response from Apache.

As you can see, I know just enough to be dangerous, fortunately only to myself, I hope!

Gareth
  • 19,080

1 Answers1

1

At the very least, your hosts file is incorrect, and can cause problems.

Localhost is always 127.0.0.1. That is a special IP address used only for that. It is the address that the network adapter uses to communicate internally.

You should change the DNS name for 10.0.1.2 to something other than "localhost".

http://en.wikipedia.org/wiki/Localhost

KCotreau
  • 25,622