I can not configure the sqlsrv drivers in php7 [duplicate]

4

In the file php.ini all extensions are found, less the ones I need to connect to the SQL Server database.

extension=php_sqlsrv_7_ts_x64.dll
extension=php_pdo_sqlsrv_7_ts_x64.dll

The .dll is in the C:\php7\ext.

No php.ini is mapped:

; Directory in which the loadable extensions (modules) reside.
; http://php.net/extension-dir
; extension_dir = "./"
; On windows:
extension_dir = "C:\php7\ext"

When I run php.exe , it returns the following message:

  

the procedure entry point call_user_function could not be locale in the dynamic library C:\php7\ext\php_pdo_sqlsrv_7_ts_x64.dll
the procedure entry point call_user_function could not be locale in the dynamic library C:\php7\ext\php_sqlsrv_7_ts_x64.dll

    
asked by anonymous 04.01.2017 / 19:26

2 answers

3

Download the Microsoft Drivers for PHP for SQL Server package and unzip a folder and grab these two files into the ext folder of :

  

For x86 :

extension=php_sqlsrv_7_nts_x86.dll
extension=php_pdo_sqlsrv_7_nts_x86.dll
  

For x64 :

extension=php_sqlsrv_7_nts_x64.dll
extension=php_pdo_sqlsrv_7_nts_x64.dll

Test the connection to:

$localhost = "localhost";
$database  = "testdb";
$user = "sa";
$pass = "12345";
$c = new PDO("sqlsrv:Server=$localhot;Database=$database", $user,$pass);

adjusting your bank's settings.

References:

04.01.2017 / 19:40
2

I also had problem and I did not get it that way, I used it in the same PDO and it worked out

  $p= new PDO('odbc:Driver={SQL Server};Server=NOMEDOSERVER;Database=NOMEDOBANCO; Uid=LOGIN;Pwd=SENHA');

  $stmt = $p->prepare("SELECT *  FROM usuario");
    
04.01.2017 / 19:36