How to Turn on the MSSQL API Module in PHP?
Submitted by: AdministratorIf you want to access SQL Server database with PHP scripts, the first thing you need to do is to turn on the MSSQL API Module as shown in this tutorial:
1. Prepare a single line script to test the MSSQL API Module:
<?php
mssql_connect('LOCALHOST','sa','GlobalGuideLine');
?>
Run the script, you should get:
Fatal error: Call to undefined function mssql_connect()
in C: estglobalguideline.php on line 2
2. If you C:phpphp.ini does not exist, copy C:phpphp.ini-dist to C:phpphp.ini. Open C:phpphp.ini and remove (;) on the extension=php_mssql.dll setting:
;extension=php_mssql.dll
extension=php_mssql.dll
Run the script again, you may get:
PHP Warning: PHP Startup: Unable to load dynamic library
'C:php5php_mssql.dll' - The specified module could not
be found.
in Unknown on line 0
Fatal error: Call to undefined function mssql_connect()
in C: estglobalguideline.php on line 2
3. Open C:>phpphp.ini and change the extension_dir setting. The default setting is "./", but all extension module DLL files are in ./ext.
Submitted by: Administrator
1. Prepare a single line script to test the MSSQL API Module:
<?php
mssql_connect('LOCALHOST','sa','GlobalGuideLine');
?>
Run the script, you should get:
Fatal error: Call to undefined function mssql_connect()
in C: estglobalguideline.php on line 2
2. If you C:phpphp.ini does not exist, copy C:phpphp.ini-dist to C:phpphp.ini. Open C:phpphp.ini and remove (;) on the extension=php_mssql.dll setting:
;extension=php_mssql.dll
extension=php_mssql.dll
Run the script again, you may get:
PHP Warning: PHP Startup: Unable to load dynamic library
'C:php5php_mssql.dll' - The specified module could not
be found.
in Unknown on line 0
Fatal error: Call to undefined function mssql_connect()
in C: estglobalguideline.php on line 2
3. Open C:>phpphp.ini and change the extension_dir setting. The default setting is "./", but all extension module DLL files are in ./ext.
Submitted by: Administrator
; Directory in which the loadable extensions (modules)...
; extension_dir = "./"
extension_dir = "./ext"
Run the script again, you may still errors. But it is not related to MSSQL API Module any more.
Warning: mssql_connect(): Unable to connect to server:
LOCALHOST in C: estglobalguideline.php on line 2
Submitted by: Administrator
; extension_dir = "./"
extension_dir = "./ext"
Run the script again, you may still errors. But it is not related to MSSQL API Module any more.
Warning: mssql_connect(): Unable to connect to server:
LOCALHOST in C: estglobalguideline.php on line 2
Submitted by: Administrator
Read Online MS SQL Server Job Interview Questions And Answers
Top MS SQL Server Questions
☺ | How To Convert Binary Strings into Integers in MS SQL Server? |
☺ | What Happens If You Insert a Duplicate Key for the Primary Key Column in MS SQL Server? |
☺ | Does Index Slows Down INSERT Statements? |
☺ | PHP MSSQL - How To Display a Past Time in Days, Hours and Minutes? |
☺ | Can You Roll Back the DDL Statement in a Trigger? |
Top Databases Programming Categories
☺ | RDBMS Interview Questions. |
☺ | SQL Interview Questions. |
☺ | SSRS Interview Questions. |
☺ | Database Administrator (DBA) Interview Questions. |
☺ | Sybase Interview Questions. |