This question has already been answered:

Good day.

PHP 7, IIS 7.5 Windows Server 2008r2 when trying to connect to MSSQL an error occurs:

PHP Fatal error: Uncaught Error: Call to undefined function sqlsrv_connect() in C:\inetpub\путь\connect.php:4 Stack trace: #0 {main} thrown in C:\путь\connect.php on line 4 

extension=php_mssql.dll no extension=php_mssql.dll directive in php.ini extension=php_mssql.dll no php.ini itself in this release, it was replaced with php.ini-development and php.ini-production

The script itself:

 $serverName = "mssql02\"; $connectionInfo = array( "Database"=>"", "UID"=>"", "PWD"=>""); $conn = sqlsrv_connect( $serverName, $connectionInfo); if( $conn ) { echo "Соединение удалось.<br />"; }else{ echo "Соединение не удалось, ошибка:"; die( print_r( sqlsrv_errors(), true)); } 

the fact that there is no server name, username, password, etc. is not an error, just removed specially

PDO downloaded, threw in the ext folder: enter image description here in php config added line: enter image description here

but you don't want to work

There are no PDO drivers in the phpinfo output. enter image description here

Reported as a duplicate by Visman , aleksandr barakin , user194374, Alex , Denis Bubnov on Dec 6 '16 at 8:42 .

A similar question was asked earlier and an answer has already been received. If the answers provided are not exhaustive, please ask a new question .

  • And in phpinfo() it is clear that there is an extension? - u_mulder
  • Of course, I don’t know how it is on Windows, but you may need the necessary php.ini-* copy it in php.ini ? - u_mulder

1 answer 1

ODBC driver in Windows install.

Here is a bunch of links where and what to install

http://fi2.php.net/manual/ru/ref.pdo-sqlsrv.php

Especially helpful in comments (ODBC driver)

http://www.microsoft.com/en-us/download/details.aspx?id=20098

  • Thank you very much, you can link if not difficult, but suddenly the version will not be there or something else - qaz qaz
  • downloaded, put the same trouble - qaz qaz
  • Links added. By versions I will not tell you anything. Put under windows + php5.6 + apache. - Mrak