1

I'm trying to get PHP to load some extensions (sqlsrv driver for PHP PDO). I'm using a wamp server, With PHP 5.4, Apache 2.4.4.

In my PHP.ini file, i've entered the following line:

extension_dir = C:\wamp\bin\php\php5.4.16\ext
...
extension=php_pdo_sqlsrv_54.nts.dll

However in the apache error log, whenever I restart the apache service, I get the error message:

PHP Warning:  PHP Startup: Unable to load dynamic library 'c:/wamp/bin/php/php5.4.16/ext/php_pdo_sqlsrv_54_nts.dll' - The specified module could not be found.\r\n in Unknown on line 0

Now, I know for a fact, this error is incorrect. If I copy the file location directly from the error log, (C:\wamp\bin\php\php5.4.16\ext\php_pdo_sqlsrv_54_nts.dll) and paste it into windows explorer, it finds the file fine.

I've added the ext directory to windows PATH environment variable, still no success.

Any ideas what to try next? Thanks

Phil Cross
  • 9,017
  • 12
  • 50
  • 84
  • What you see when you right click the wamp icon in your start up and navigate to PHP, Extension ? Can you see php_pdo in the extensions with a tick mark ? – Vineesh Sep 25 '13 at 10:20
  • have you looked at your phpinfo() to confirm that it is using the right php to make sure you only have one installation of php that is – Liam Sorsby Sep 25 '13 at 10:21
  • @VineeshPoduval The extension is ticked, however it's still coming up with the same 'unable to load dynamic library' error :( – Phil Cross Sep 25 '13 at 10:23
  • @LiamSorsby I've doubled checked the loaded ini file, which is also the correct one, and also the extension_dir registered. I've already added all the correct .dll files to the extension_dir directory, and installed the SQL native driver, but still no luck – Phil Cross Sep 25 '13 at 10:27
  • @PhilCross This looks like Apache can't find the dll files (in the php directory). The solution is to add "C:\wamp\bin\php\php5.4.16" (or similar directory) to your system PATH. The other solution is to copy your dll files to your apache's bin directory. A third option is to copy the dll files to your windows system directory (system32 or 64). Also please verify you pass all the system requirement, mentioned here http://technet.microsoft.com/en-us/library/cc296170(v=sql.105).aspx. – Vineesh Sep 25 '13 at 10:57
  • @VineeshPoduval Thanks for the reply, I've ensured that the PATH variable points to the extension directory, I've also copied all the relevant dlls to the PHP extension directory, Apaches extension directory. I've even created a new virtual server to to a fresh install of all the required software, still not able to be found :( – Phil Cross Sep 25 '13 at 11:34
  • i had this issue with wamp so i used virtualbox and installed a copy of centos onto mine and used the apache in there. not a very good work around for wamp but it worked – Liam Sorsby Sep 25 '13 at 11:41
  • try this: http://stackoverflow.com/questions/11439772/wampserver-problems-to-load-php-pdo-pgsql-and-php-pgsql-modules – Liam Sorsby Sep 25 '13 at 11:46
  • @LiamSorsby Unfortunately I need the wamp installation to contact a MySQL and MSSQL database (both with PDO). I tried it with unix on our external server, but found freetds a bit of a headache to install :( – Phil Cross Sep 25 '13 at 11:47
  • Maybe missing access rights for your apache user to the requested dll file? – ToBe Sep 25 '13 at 13:35
  • Unfortunately not, php running as system, which has full access to the directory path. – Phil Cross Sep 26 '13 at 07:18

1 Answers1

1

Your problem is that you are trying to run a NTS 'Not Thread Safe' dll with a PHP that is 'Thread Safe', so initially try downloading the Thread Safe version of the sqlsrv DLL.

BIG NOTE and possibly your next problems solution:

As far as I know the sqlserver database interface dlls are only available as 32bit. So if you have installed the 64bit WAMPServer you will have to uninstall and install the 32bit WAMPServer.

RiggsFolly
  • 93,638
  • 21
  • 103
  • 149
  • Sorry for the late acceptance! I had installed the 64bit wampserver, and did find out the sqlsrv drivers are only 32bit (pretty annoying!!). I've put it on hold for the time being, and will try again when I have more patience! – Phil Cross Feb 05 '14 at 23:53