Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a fresh Joomla installation in a Mac OS X and I have configured a database to connect the application to. By default, Joomla uses localhost to connect (variable $host), but it does not work.

However, if I replace localhost with 127.0.0.1 it does connect. I have installed MySQL using MacPorts.

It seems this is the opposite problem asked in another question.

What can I do to be able to use localhost instead of plain IP?

Here is my /etc/hosts content:

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1       localhost
255.255.255.255 broadcasthost
::1             localhost 
fe80::1%lo0     localhost

Thanks!!

share|improve this question

Add

127.0.0.1 localhost

To the hosts file, found at this location

/private/etc/hosts

Save the hosts file and restart your web server. The hosts file maps IP addresses, such as 127.0.0.1, with hostnames, such as localhost.

Here is a tutorial on the Mac hosts file.

share|improve this answer
    
As you can see in my question update, my /etc/hosts had that line already :) – elitalon Jul 1 '11 at 22:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .