Greg Ostry
Greg Ostry

Reputation: 1231

How to install an SQLSRV extension to php XAMPP

I'm trying to install a SQLSRV extension. My PHP version is 7.2 (XAMPP 3.2.2) and I use windows 10. I downloaded the .dll from here: https://github.com/Microsoft/msphpsql/releases. Then I unpacked it to the xampp/php/ext folder enter image description here

After that I opened the php.ini and added this extension:

  1. extension=php_pdo_sqlsrv_72_nts
  2. extension=php_sqlsrv_72_nts

Next I restarted the Apache server.

Unfortunately when I open the phpinfo website I don't see the extension. Also when I open the XAMPP shell and type php I'm getting an error.

PHP Startup: Unable to load dynamic library 'php_pdo_sqlsrv_72_nts' (tried: C:\xampp\php\ext\php_pdo_sqlsrv_72_nts (Module was not found.)

My extension_dir in php.ini is set to extension_dir="C:\xampp\php\ext".

Architecture is x86.

What did I do wrong?

EDIT: I've changed the nts to ts files and now its working.

Upvotes: 8

Views: 27866

Answers (2)

AleM
AleM

Reputation: 91

worked for me by telling in the PHP.ini file in this way:

extension=mysql
extension=sqlsrv
extension=pdo_sqlsrv

so, you have to remove "php_" and ".dll"

Upvotes: 7

Emtiaz Zahid
Emtiaz Zahid

Reputation: 2835

  • Please Make sure the extension and php.ini file is in same path. and you running same php.exe file.
  • If there is no path issue then you can try it:

Remove the

php_

prefix from your php.ini file. because php automatically searching with the name of file with the prefix: php_pdo_sqlsrv_72_ts_x86.dll Example: if you register the dll file as:

pdo_sqlsrv_72_ts_x86

then php will search the dll file as:

php_php_pdo_sqlsrv_72_ts_x86.dll

Upvotes: 5

Related Questions