Collections:
Turning on the MSSQL API Module
How to Turn on the MSSQL API Module?
✍: Guest
If 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','FYIcenter'); ?>
Run the script, you should get:
Fatal error: Call to undefined function mssql_connect() in C:\test\fyi-center.php on line 2
2. If you C:\php\php.ini does not exist, copy C:\php\php.ini-dist to C:\php\php.ini. Open C:\php\php.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:\php5\php_mssql.dll' - The specified module could not be found. in Unknown on line 0 Fatal error: Call to undefined function mssql_connect() in C:\test\fyi-center.php on line 2
3. Open C:\>\php\php.ini and change the extension_dir setting. The default setting is "./", but all extension module DLL files are in ./ext.
; 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:\test\fyi-center.php on line 2
⇒ ntwdblib.dll - SQL Server Client Library DLL
⇐ Requirements for Connecting PHP to MS SQL Server
⇑ SQL Server FAQs - PHP MSSQL Functions - Connections and Query Execution
2024-04-14, 1284🔥, 0💬
Popular Posts:
How To Divide Query Output into Multiple Groups with the GROUP BY Clause in SQL Server? Sometimes, y...
How To Locate and Take Substrings with CHARINDEX() and SUBSTRING() Functions in SQL Server Transact-...
How To Convert Binary Strings into Hexadecimal Character Strings in SQL Server? When a query returns...
What Is a Dynamic Performance View in Oracle? Oracle contains a set of underlying views that are mai...
How To Use SQL*Plus Built-in Timers in Oracle? If you don't have a stopwatch/timer and want to measu...