Articles in the Series
- Part 1 – Installing Apache
- Part 2 – Installing MySql
- Part 3 – Installing and Configuring PHP
- Part 4 – Installing MediaWiki
We are now up to installing PHP. Here is how I installed it using the zip file
- Download the latest version of PHP from here. I just get the Zip package of the windows binaries
- Create a directory called PHP on the C:\. In this guide I’m going to put it at “C:\PHP”.
- Extract all of the contents of the zip file into the PHP directory.
- Make a copy of the “php.ini-recommended” file and name it “php.ini”. I tend to leave the file in the C:\PHP directory even though some documentation says to put it elsewhere.
- Open the “php.ini” file and look for “doc_root”. Set it to “C:\Program Files\Apache Software Foundation\Apache2.2\htdocs” (Including Quotes). This directory is where the apache files are served from.
- In the same file look for “extension_dir”. And set it to “C:\php\etc”. What we are doing here is telling php where the extension dll’s are stored.
- In the same file look for a line that says “;extension=php_mysql.dll” and remove the ; from the start. This will tell php to use the MySql extension.
- Save the File.
- In the “C:\PHP\” there is a file called “libmysql.dll”. Copy it to “C:\Windows\System32”. This is so that PHP can communicate with the MySql server! It essentially puts the dll into a search path and php will use the extension to talk to this dll (I think!)… thus allowing php to communicate with MySql
- Go to the “htdocs” folder in the apache install: “C:\Program Files\Apache Software Foundation\Apache2.2\htdocs”
- Create a file called “info.php”
- Type “<?php phpinfo(); ?>” into the file and save (don’t include the quotes)
- Open your Browser and type http://localhost:8080/info.php We are not there yet of course. You should see the text you have typed in the file. We now need to tell Apache to pass .php files to the php processor. To do that navigate to the “conf” folder in the Apache installation -> “C:\Program Files\Apache Software Foundation\Apache2.2\conf”
- Open the “httpd.conf” file
- Add the following to the file and save it (This essentially tells Apache to let php process the file contents before sending it to the clients browser. PHP will then do it’s processing on the file, pass it back to Apache which will then send the processed file to the browser/user agent.)
# PHP 5 Settings
LoadModule php5_module "C:\php\php5apache2_2.dll"
AddHandler application/x-httpd-php .php
AddHandler application/x-httpd-php-source .phps
- Restart Apache using the tool in the notification area.
- Browse to http://localhost:8080/info.php. instead of the php code you should see a page with a lot of php information on it.
- Search the page for the words “MySql”. If it is present then you are set to go!
Now to install MediaWiki!