Welcome to Amin Mahmoudi official website.
Last Blog Posts :
How to connect PHP to Microsoft SQL Server Our Private World of Warcraft Fun 3.3.5a Server Started Install GCC7 in CentOS & Ubuntu Use Telegram bot to get notifications about your MasterkinG account Unveiling new version of MasterkinG32 website 
Main Menu
User Panel

How to connect PHP to Microsoft SQL Server

How to connect PHP to Microsoft SQL Server
Rate 5/5 Based on 1 Reviews

PHP with SQL Server

First you need get information about your PHP.

Make a test file with this code :

then you see a ouput like this :

phpinfo funcation example

Here, We have XAMPP, PHP 7.2.8 - x86 & TS.

Now, go to this link : github.com/Microsoft/msphpsql

Find your OS  & PHP version in production release. (We select Windows-7.2.zip)

Extract downloaded file, we go to x86 folder then copy php_pdo_sqlsrv_72_ts.dll & php_sqlsrv_72_ts.dll  to xampp/php/ext.

Open php.ini file xampp/php/php.ini (If not exists, rename php.ini-development to php.ini)

Insert the codes after extension = pdo_mysql (Change file name to your version)

Restart your web server. (Apache, Nginx or etc)

Open your phpinfo again, now in "Registered PHP Streams" section you have sqlsrv & you can search & find pdo_sqlsrv in your phpinfo.

Now you can use sqlsrv_connect function to connect your SQL Server.

For PDO connection you can use this :

Sincerely, The MasterkinG32 Team

Send Comment