HOWTO: Installation of Apache/PHP/MySQL on Windows Vista
I’ve been reading a lot about people having problems getting this to run, so here’s a small HOWTO on installing. Starting point is a fresh Vista Ultimate installation, but this should work on other variants aswell.
Pre requisites:
- Apache install for Windows. I used: Apache 2.2.4
- PHP, full zip files. I used: PHP 5.2.2
- MySQL, full version without installer. I used: 5.0.41
- Turn of Windows UAC (feel free to turn it back on after installation, if you’re a big fan)
Steps:
Windows UAC
If you have this turned on, you will have problems creating services and Windows will bug you with install messages all the way. If you’re fond of those, feel free to turn it back on when we’re done.
Open up the Control Panel and go to User Accounts and Family Safety. Click on User Accounts. Select Turn User Account Control on or off. Deselect the option and click Ok. Restart Windows to complete the change.
Apache Install
- Run through the “normal” install of Apache. Alter stuff like domain name, servername and webmaster e-mail. The rest will do just fine.
- Remove the Apache Monitor from the Startup program group. Somehow, it doesn’t work properly and it’s functionality isn’t too impressive anyway.
PHP Install
- Create a directory for PHP. I will use C:\PHP, if you use anything else, make sure to change that in the installation scripts.
- Extract the contents of your PHP zip into your PHP directory
- Copy the file PHP.ini-dist to PHP.ini. This will be your PHP settings file, aimed at developing sites, not running them. (Then, who would be running sites from a Vista machine anyway?)
- Modify the PHP.INI file:
- Find the setting for extension_dir and change it so the line reads: extension_dir = “C:/PHP/ext”
- Find the line with the MySQL extension and uncomment it so it reads: extension=php_mysql.dll
- Add your PHP directory to the path. You can do this by right-clicking Computer in the Vista startmenu, select Properties. In the window you see now, select the Task: Advanced system settings. From the new window select Environment variables and find the PATH setting in the section with System variables. Double click it and add “;C:\PHP” to the end of the value. (Without the quotes of course).
- Locate your Apache configuration file. This will be in C:\Program files\Apache Software Foundation\Apache2.2\conf and it will be named httpd.conf. Edit it with your editor of choice.  Â
- Find the section which defines the DirectoryIndex. It will now only have index.html. You will most likely want to add index.php to this. The line will then read: DirectoryIndex index.html index.php
- Go to the bottom of the file and add the following lines:
   # PHP5 installation:
   LoadModule php5_module “c:/php/php5apache2_2.dll”
   AddType application/x-httpd-php .php
   # configure the path to php.ini
   PHPIniDir “C:/php”
- Â Â
MySQL Install
- Create a directory for MySQL. If you’re not going for the default of C:\MySQL, you will have to change the ini files and I’ve noticed some weird problems in there. So I suggest to stick to the yellow brick road on this one.
- Extract the contents of the zip file.
- Copy my-small.ini to my.ini. If you want to allocate more memory to MySQL, you can choose one of the other templates, but this one usually suffices for development machines.
- Using a command prompt, navigate to C:\MySQL\bin and type:
  mysqld –install
  net start mysql
  This will register the MySQL service and start it. - Add your MySQL/bin directory to the path. You can do this by right-clicking Computer in the Vista startmenu, select Properties. In the window you see now, select the Task: Advanced system settings. From the new window select Environment variables and find the PATH setting in the section with System variables. Double click it and add “;C:\MySQL\bin” to the end of the values
That’s it! You should have a working install now. Of course there’s a zillion things you can change in your install. Personally, I always work with a bunch of virtual domains on my server, which makes it easier to develop more than one site at the same time. And due to size constraints, I park my MySQL data on another drive. All this and more can be changed in the settings.
