Archive for apache

Apache, MySQL and PHP

Posted in code with tags , , , on September 1, 2008 by Tau

It is my eventual goal that this blog, with additional elements, be hosted by myself as a fully functional website. As with the game itself, this comes not from a belief that the traffic will warrant it, but rather from a desire to know how it is done, and as a creative enterprise.

To that end I have been attempting to install and link together Apache, MySQL and PHP on my Mac. Now I know Macs come with this pre-installed, but I thought I may as well get the latest releases. Here began a labour of Hercules.

I was aware of the existence of packages like MAMP which bunble Apache, MySQL and PHP together, providing you with the directory htdocs and db for the MySQL databases, along with all the MySQL scripts. It comes with a nice GUI for turning the servers on and off and a web interface for creating SQL tables and the like. Well, I thought, that’s just for people who don’t know what they’re doing (people, it turns out, like me). So after downloading the latest releases I set about building them. Apache went quite smoothly, and I was running HTML documents on localhost through firefox in no-time. PHP took a little more time, as I ultimately had to amend Apache’s configuration document httpd.conf so it knew what to do with .php files. (Note: I really wish I could go through everything in detail, and I wished others had done during the many hours of googling, but I have of course forgotten).

MySQL just wouldn’t work. It constantly timed out due to some problem with the pid file, and despite plenty of modifying of my.cnf or changing of permissions, nothing seemed to work. Strangely, it did briefly. The server didn’t time out and I could run the mysql script, although it wouldn’t connect via PHP in a webpage. So I restarted my computer, and the nothing worked. Not MySQL, not PHP, not Apache.

Finally, after numerous re-installs and re-builds, I gave up and used MAMP, which runs perfectly. When I build a server to host a site for real, I’m sure I’ll deal with this again, but for the moment it’s simply about learning the tricks of the trade.