7

I am trying to use sql-server with php . I downloaded 64 bit php_pdo_sqlsrv_56_ts.dll and php_sqlsrv_56_ts.dll from this unofficial site. I extracted the dll files to D:\wamp64\bin\php\php5.6.31\ext. In php.ini I have added the following lines and restarted the WAMP:

[PHP_SQLSRV]
extension=php_sqlsrv_56_ts.dll
[PHP_PDO_SQLSRV]
extension=php_pdo_sqlsrv_56_ts.dll

in WAMP>php>extensions , it shows me this:

enter image description here

on clicking those extensions, php console shows the error The 'php_sqlsrv_56_ts.dll' extension file exists but there is no 'extension=php_sqlsrv_56_ts.dll' line in php.ini. .

I have no idea where the problem is, i found out same question here but that was version (32/64) issue which is also not my case as i have downloaded 64 bit extensions already.

Any suggestions would be extremely helpful.

whoosis
  • 454
  • 7
  • 25
  • 1
    Did you make any changes in your `php.ini`? You will need something like `extension_dir = C:\php\extensions`. You will need to change the [extension_dir](http://php.net/manual/pl/ini.core.php#ini.extension-dir) setting to point to the directory where your extensions lives. – Ilyes Nov 18 '17 at 14:34
  • 1
    @Sami `extension_dir` was already set in `php.ini` and i added these dll's to that directory to which `etension_dir` was set . – whoosis Nov 18 '17 at 18:57

2 Answers2

11

Apparently, there are two php.ini files, one in wamp>bin>PHP folder and the other is in Apache folder which is also available from in wamp tray icon. I updated the file in php folder, and on checking ,the php.ini in wamp (tray icon) wasn't updated. On updation of that file, the issue was resolved.

whoosis
  • 454
  • 7
  • 25
1

C:\wamp64\bin\php\php7.4.9\phpForApache.ini file is the same as the C:\wamp64\bin\apache\apache2.4.46\bin\php.ini They are connected files.

When you change one the another one is updated automatically.

ie. If you use php 7.4.9 you should edit this C:\wamp64\bin\apache\apache2.4.46\bin\php.ini or C:\wamp64\bin\php\php7.4.9\phpForApache.ini

not this one-> C:\wamp64\bin\php\php7.4.9\php.ini

and beside you should add correct version dll or so.

for example for 7.4.9 it should contain 74 so on.

like

extension=php_pdo_sqlsrv_74_ts_x64.dll

further more restarting apache is not enough you shoul restart wamp.

enter image description here

Hakan
  • 240
  • 3
  • 4