1

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!!

1 Answer 1

0

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.

1
  • As you can see in my question update, my /etc/hosts had that line already :)
    – elitalon
    Jul 1, 2011 at 22:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.