Pages

Monday, September 17, 2007

Configuring PHP 5.2.3 To Work With MySQL 5.0 in IIS 5/6 Environment

By assuming the installation for PHP 5.2.3 and MySQL 5.0 were complete (normal/default installation), the following are the necessary steps to make the PHP and MySQL talk to eah other.

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"

Step 3: Edit this file "php.ini" using a text editor like notepad. Find the line where it says "extension_dir = *something*". Uncomment this line by removing the preceding semi-colon. and set it to say: extension_dir="c:\php\ext". But you need to comment the line where it says doc_root. Otherwise an error that says "No input file specified" will appear if you test any php script. (Php only interprets phpfiles that are located in or below the doc_root directory)

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

Step 5: Reboot the computer

And you are done.

No comments: