You are hereBlogs / Carl's blog / Noob's Guide to Hosting Apache, PHP, and MYSQL on an XP Box

Noob's Guide to Hosting Apache, PHP, and MYSQL on an XP Box


By Carl - Posted on 03 November 2009

Printer-friendly versionPDF version

 The other day I had to set up Apache, PHP, and MYSQL on my Windows XP machine to host a test a Drupal site I am helping develop.  The http folder was in a different folder because it was in a Git repository (more on that experience in a later post). Needless to say, I went to the places outlined in Drupal's installation requrements page, and I had a very difficult time getting Apache and PHP to link. It was so much easier in Linux. I tried until I gave up and found a much easier solution. 

The Solution

I found a suite called XAMPP that installs PHP, Apache, MYSQL, PERL, and a whole suite of other useful components. This exists for just about every operating system, but in this blog I'm writing about Windows XP, so I'll stay specific to that.

I downloaded the regular installer (not the Lite or the Addons version), and installed it with pretty much the default settings, and was sure to set a password for my MySQL root. I then went to the XAMPP control panel at start>all programs>xampp>XAMPP Control Panel and started up the .Apache and MySQL services as seen below:

I then went to my localhost url (http://localhost) and found a wonderful control panel where I could set up my Drupal database right from there.  Note: if you are setting up something like this and you want it in the root directory, it is probably a good idea to take advantage of this feature, and poke around and change whatever other settin as it will go away once you overwrite the root.

Finally, I was ready to start the Drupal install.  I copied the default.settings.config to settings.config and updated the database settings in it as per the Drupal instructions.  However, because I was using a Git repository, the folder was somewhere else.  I found the easiest way to point my html root there was to open the httpd config file provided by XAMPP (found in \xampp\apache\conf\httpd.conf). I edited the following two variables to point to my drupal http directory:

 

<Directory "C:/drupal_directory/http">

DocumentRoot "C:/drupal_directory/http"

Note that the slashes, unlike most Windows applications are forward slashes like "/"

 

This was a really quick'n'dirty fix for setting up a test/development PHP/Apache/MySQL host on my XP box, but it worked.  Of course, if you are thinking of hosting a real website, I would recommend you research XAMPP a bit more, or simply get a Linux host, where you can just yum everything and it will work :)

 

Share/Save
Tags

Fuelly