- Joined
- Oct 27, 2008
- Messages
- 276
- Reaction score
- 36
How to use the php mssql_connect on SQL Server 2008 with dblib extension.
Part l:
1. Stop all WebServer services and the SQL Server (Express) service.
2. Download ntwdblib.dll version 2000.80.194.0 (Can get copy of ntwdblib.dll by downloading MS SQL Server 2000 SP4 from Microsoft Website. It contains a copy of ntwdblib.dll version 2000.80.194.0 in the system directory).
Copy and replace any other versions of this file to the following locations:
(Directories may be different for different web servers)
4. Configure SQL Server for Mixed mode authentication and remember the password you set for sa
5. Start the SQL Server Service
6. Edit your php.ini and set the mssql.secure_connection = On
7. Make sure your webserver folder has proper access rights (full control for 'everyone').
8. Start all services of your webserver.
Part II:
1. Open your webserver's php.ini file.
2. Find extension=php_mssql.dll and put ; before extension (example: ;extension=php_mssql.dll)
3. Copy php_dblib.dll to php\ext folder.
4. On php.ini, add extension=php_dblib.dll like last extension row.
5. Restart your webserver
You can connect to your SQL Server instance like this:
$dbhandle = mssql_connect('.\SQLEXPRESS','username','password');
$db = mssql_select_db('databasename', $dbhandle);
Guide is tested on php 5.2.9 and SQL Server 2008.
Part l:
1. Stop all WebServer services and the SQL Server (Express) service.
2. Download ntwdblib.dll version 2000.80.194.0 (Can get copy of ntwdblib.dll by downloading MS SQL Server 2000 SP4 from Microsoft Website. It contains a copy of ntwdblib.dll version 2000.80.194.0 in the system directory).
Copy and replace any other versions of this file to the following locations:
(Directories may be different for different web servers)
- Your PHP binaries folder (webserver\php)
- Your Apache binaries folder (webserver\apache\bin)
- Windows\System32\
4. Configure SQL Server for Mixed mode authentication and remember the password you set for sa
5. Start the SQL Server Service
6. Edit your php.ini and set the mssql.secure_connection = On
7. Make sure your webserver folder has proper access rights (full control for 'everyone').
8. Start all services of your webserver.
Part II:
1. Open your webserver's php.ini file.
2. Find extension=php_mssql.dll and put ; before extension (example: ;extension=php_mssql.dll)
3. Copy php_dblib.dll to php\ext folder.
4. On php.ini, add extension=php_dblib.dll like last extension row.
5. Restart your webserver
You can connect to your SQL Server instance like this:
$dbhandle = mssql_connect('.\SQLEXPRESS','username','password');
$db = mssql_select_db('databasename', $dbhandle);
Guide is tested on php 5.2.9 and SQL Server 2008.
Attachments
Last edited: