Monday, July 9, 2007

Configuring PHP and MySql on IIS (Windows XP)

These instructions are for the following versions: PHP 5.2.3, MySql 5.0 and IIS 6.0

Steps may change a little with other versions.


Installing PHP

Step 1: Create a folder on C: called "PHP" and unzip the files from the PHP download into that folder.

Step 2: Open IIS6 Manager Right Click -> Default Website -> Properties -> Select Home Directory -> Select Configuration. On Application configuration check to see if .php is in list. If not click "Add". For executable browse to "c:\php" folder and select "php5isapi.dll". Click "OK" and then "OK" again.

Step 3: In the "C:\PHP" folder copy the file "php.ini-recommended" to your C:\WINDOWS folder. Rename this file to "php.ini"

Step 4: Create a test file in the root of your web folder called "phpinfo.php" and insert the code below:

<php
phpinfo();
?>

Step 5: Click Start --> Run and type IISRESET and press enter.

Step 6: Open Internet Explorer and type "http://127.0.0.1/phpinfo.php" and you should see it give you information about the PHP version.

If you see a page with all sorts of information about your PHP version that means your installation was successful.

Configuring MySQL

While running the setup you will need to configur an Instance. You can choose the following options while following the wizard.

MySQL Server Instance Configuration Wizard --> Detailed Configuration --> Developer Machine --> Non-Transactional Database Only --> Decision Support (DSS)/OLAP --> Check Enable TCPIP Netwokring --> Port 3306 --> Standard Character Set --> Install as a Windows Service --> Give it a password --> Execute!!

Configuring PHP for MySQL

Step 1: In the C:\PHP folder copy the file "libmysql.dll" to your C:\WINDOWS\SYSTEM32 folder. Make sure you don't overwrite any existing file in this folder. If file exists, first rename it so you can go back.

Step 2: In the C:\PHP folder copy the file "php.ini-recommended" to your C:\WINDOWS folder. Rename this file to "php.ini" (You already did this.)

Step 3: Edit this file "php.ini" using a text editor like notepad. Find the line where it says "extension_dir = ***". Uncomment this line by removing the preceding semi-colon. and set it to:

extension_dir="c:\php\ext"

Step 4: In the same file "php.ini" also un-comment out 2 other where it says: extension=php_mysql.dll and extension=php_mysqli.dll by removing the semi-colon.

Step 5: Click Start --> Run and type IISRESET and press enter.

You are good to go!!



No comments: