Joomla Installation Failure
Recently I encountered a very frustrating error while installing Joomla! 1.5 on my development machine (Windows 7 / Apache 2.0 / PHP 5.3 / MySQL 5.1). I followed the easy to use installation wizard but when I reached the database configuration step (step 4 I believe) things got ugly.
I entered the database information (host, user name, password, and database name) and then click next. After about 30 seconds I saw a blank screen. A quick look at the logs returned very little information; all I found was an error 500 in Apache’s access log. After some digging around I came to the conclusion that is must be a problem between PHP and MySQL.
I whipped up a quick test would help me diagnose the problem.
mysql_connect("localhost", "root", "mypassword") or die("Could not connect to database."); print "Connected to database.";
I was expecting to see ‘Could not connect to database.’ and to have some useful info dumped into the logs. Instead I received a blank screen after about 30 seconds… Eureka! This is the exact same problem I had with the Joomla! install.
After reading through the mysql_connect docs, I discovered that connecting to ‘localhost’ actually attempts to use a socket (named pipe on Window) but connecting to ‘127.0.0.1’ will use TCP/IP.
Apparently, I configured MySQL to accept connections from TCP/IP but not sockets/pipes. When mysql_connect attempted to connect to MySQL it did not receive a response and after about 30 seconds PHP timed-out the request resulting in a 500 error response.
I fixed this problem by simply changing my host parameter from ‘localhost’ to ‘127.0.0.1’.