Sqlsrv driver does not appear on phpinfo () WAMP server after adding extension entries in php.ini file

I wanted to establish a database connection with PHP to SQL Server 2012. I have a wamp server (64-bit) installed on a Windows computer (64-bit) with PHP 5.5.12, and on the same computer I have SQL Server 2012.

Extracted sqlsrv drivers from official_link

I copied the extracted drivers php_sqlsrv_55_ts.dll, extension = php_pdo_sqlsrv_55_ts.dll to the php\ext folder, and then changed the php.ini file to include extensions

 extension = php_sqlsrv_55_ts.dll; extension = php_pdo_sqlsrv_55_ts.dll; 

Now i tried

 <?php phpinfo(); ?> 

I see the following information without any SQL server information.

enter image description here

enter image description here

It seems that the SQL server connection is not configured successfully. Can someone please guide me on what I am missing here.

+6
source share
3 answers

The 64-bit WAMP server could not connect using the driver extension = php_sqlsrv_55_ts.dll; extension = php_pdo_sqlsrv_55_ts.dll;

So, I installed the 32-bit version of the WAMP server, and now it works fine.

+3
source

Check the php error log (c: \ wamp \ logs \ php_error.log). I had the same setup (64 bit WAMP / PHP 5.5.12) and the same lack of sqlsrv link in phpinfo, and I got this error in my log:

PHP Warning: starting PHP: cannot load the dynamic library 'c: /wamp/bin/php/php5.5.12/ext/php_pdo_sqlsrv_55_ts.dll' -% 1 is not a valid Win32 application. in Unknown on line 0

The solution was to install the 64-bit version of sqlsrv drivers. I found unofficial 64-bit drivers through http://robsphp.blogspot.nl/2012/06/unofficial-microsoft-sql-server-driver.html

A warning. In my testing, I found that this 64-bit extension PHP_PDO_SQLSRV is 10 times slower than when using PHP_PDO_ODBC.

+2
source

I visit this topic and I think it can help you and others with the same problem: How to install pdo_sqlsrv on my windows 2008 server 2008 R2?

The PDO extension does not match the internal driver offered by Microsoft. For PDO you must enable

extension = php_pdo_mssql.dll in your php.ini.

{Usually this file (php_pdo_mssql.dll) should be in your PHP extension directory (C: ... \ php \ ext). If this is not the case, you can download PHP from http://windows.php.net/download/ and just grab the extension from the package there (grab the one that matches your version of PHP, of course)}.

Above taken from PDO MSSQL Server - driver not found; read for more details. I have the same problem as Linux, and I saved all the pages, so I quote the help for you.

if all of the above does not work for you:


On php.net it is indicated that

On Windows, PDO_ODBC is built into the PHP core by default. It is associated with the Windows ODBC driver manager so that PHP can connect to any database cataloged as a system DSN and is the recommended driver for connecting to Microsoft SQL Server databases. http://php.net/manual/en/ref.pdo-odbc.php

You can connect to the mssql server using odbc drivers, since I never connect on my own from the windows that I use to do this via linux using freeTds, the following pages can help you

0
source

Source: https://habr.com/ru/post/978368/


All Articles