Getting Microsoft PHP PDO to work in SQL Server

I am trying to get a PHP PDO driver to run a SQL server. I received the file from Microsoft.

I am using PHP 5.3. I copied php_pdo_sqlsrv_53_nts.dll to my PHP extension directory and changed PHP.INI . The error log displays

[31-Mar-2012 20:11:38] PHP Warning: running PHP: the dynamic library 'c: \ php \ ext \ php_pdo_sqlsrv_53_nts.dll' cannot be loaded - the specified module was not found. in Unknown on line 0

The file exists. I checked it with DEPENDS.EXE and skipped MSVCR100.DLL and MSVCP100.DLL , and I ran all the VC ++ runtime packages and got the DLLs. DEPENDS reports two missing dependencies, LINKINFO.DLL and IESHIMS.DLL . Not sure what it is.

I do not have PHP_PDO.DLL ; from what I read, I pointed out that PHP 5.3+ creates PHP_PDO.DLL in PHP. phpinfo has a "PDO" section that has "PDO drivers" = "no value" . I am not sure what this value should be.

I tried restarting the web server (as opposed to not only restarting the service), as suggested in another post, but this did not fix it.

Works on Windows Server 2008 with IIS and on x64.

+8
php sql-server pdo
source share
5 answers

I noticed a footnote in the Microsoft documentation that said that version 3 of the PDS drivers required PHP> = 5.3.6. Since I am running 5.3.1, and I canโ€™t switch from it, seniors are working fine even though they are out of date.

+2
source share

I suffered from the same problem for 2 days and finally found a solution.

1. Install PHP: 5.3 recommended. (All .dll files associated with 5.4 will not work!) Http://www.php.net/downloads.php
2.Download Microsoft Drivers: do not use 3.0, only files with 2.0 dll will work! http://www.microsoft.com/en-us/download/details.aspx?id=20098
3. Copying drivers to the "ext" folder (by default in php 5.3, and they can be changed in php.ini)
4.Update php.ini (use a text editor or PHP manager) for example extension = php_pdo_sqlsrv_53_nts_vc9.dll (vc6 will not work!)
5. Reboot IIS
6. Check PDO support in phpinfo (): "sqlsrv" should be included in the "enable" list.
7.Connection String: sqlsrv: Server = 19x.1xx.1xx.1xx; Database = lab

Here is my environment: Windows 7 + IIS 7 + SQL Server 2008 R2, PHP 5.3

Believing in the latest version of MS is my mistake.

+4
source share

The reason he says no value for PDO Drivers is simply because he did not load any drivers. php_PDO.dll is just a library from which an additional PDO Drivers , it is not a driver. The problem remains with php_pdo_sqlsrv_53_nts.dll that you are trying to download.

phpinfo() that you provided does not matter, since we know that the dll is not loading. We need to understand why php_pdo_sqlsrv_53_nts.dll not loading.

A few simple steps before moving on:

  • Is the file name correct?
  • Is the .dll defined in the right place?
  • Is the file a thread-safe or non-thread-safe version? It is very important!
  • Did the file load correctly? It may be damaged.
+3
source share

A bit of help on the topic:

If you have an existing installation of SQL Server 2012 with Native client 11, you cannot install Native client 10 on it, which is required for Offical PHP Driver. One solution is to remove NC 11 and dependent components, then install NC 10 and NC 11 in that order, but this is not an option for heavily used servers.

The workaround for this is to use an unmanaged release made for NC 11, for example: http://robsphp.blogspot.hu/2012/06/unofficial-microsoft-sql-server-driver.html

+1
source share

I had the same problem. I installed the SQL Server 2012 client software and fixed it (I already installed the SQL 2008 client software). I believe the ODBC "Native Client 11" installation has been fixed.

0
source share

All Articles