Use Apache, PHP, and MSSQL on Windows

This is how I made the php_mssql extension work on my Windows/Apache/MSSQL/PHP (WAMP) Server.

Download Apache. (I used the Win32 Binary including OpenSSL 0.9.8m (MSI Installer))

Download PHP. (I used the PHP 5.2.13 zip package)

Download ntwdblib.dll.


Run the apache installer, select custom install and change the install path t0 ‘C:/Apache2.2’

Extract the php zip file to ‘C:/PHP’

Open C:/PHP and copy php.ini-recomended to php.ini

Open php.ini and edit the following lines:
Set extension_dir = “C:/PHPext”
Un-comment php_mssql.dll
Set error_log = “C:/Apache2.2/logs/phperr.log”

Open C:/Apache2.2/conf/httpd.conf and edit the following lines:
DirectoryIndex index.php
LoadModule php5_module C:/PHP/php5apache2_2.dll
AddType application/x-httpd-php .php
PHPIniDir “C:/PHP”

Add “C:/PHP” to the PATH Environment variable

Replace the file C:/PHP/ntwdblib.dll with the copy you just downloaded (v2000.80.194.0)

Restart the Apache service


You can now use all the mssql functions in your php code without errors

This entry was posted in apache, php, sql, windows. Bookmark the permalink.