ich zu einem SQL Server zu verbinden versuchen, die wir durch "Microsoft SQL Server Management Studio" zugreifen:Fatal error: Uncaught Fehler: Call to undefined function sqlsrv_connect()
Ich habe Ich habe eine Menge verschiedener Dinge ausprobiert, die ich auf SO gesehen habe, aber nichts hat funktioniert. Ich erhalte die Fehler Fatal error: Uncaught Error: Call to undefined function sqlsrv_connect() in C:\Apache24\htdocs\test.php:52 Stack trace: #0 {main} thrown in C:\Apache24\htdocs\test.php on line 52
wenn auf der test.php
Seite den folgenden Code ausführen:
$serverName = "SERVER.DOMAIN.COM, 1433"; //serverName\instanceName, portNumber (default is 1433)
$connectionInfo = array("Database"=>"DB_NAME", "UID"=>"USER", "PWD"=>"PASS");
$ma_conn = sqlsrv_connect($serverName, $connectionInfo);
if($ma_conn) {
echo "Connection established.<br />";
}else{
echo "Connection could not be established.<br />";
die(print_r(sqlsrv_errors(), true));
}
Meine php.ini durch viele verschiedene Erweiterungen gegangen ist freigegeben wird, aber keiner gearbeitet haben. Ich habe alle folgenden versucht:
extension = php_sqlsrv_56_ts.dll
extension=php_sqlsrv_55_ts.dll
extension=php_sqlsrv_55_nts.dll
extension=php_sqlsrv_55_ts.dll
extension=php_pdo_sqlsrv_55_ts.dll
extension=php_pdo_mssql.dll
extension=php_pdo_mysql.dll
Zur Zeit habe ich:
extension_dir = "c:\apache24\php7\ext\"
extension=php_pdo.dll
extension=php_pgsql.dll
[PHP_SQLSRV]
extension=php_sqlsrv_54_ts.dll
[PHP_PDO_SQLSRV]
extension=php_pdo_sqlsrv_54_ts.dll
Auf der Maschine mit Apache und PHP in CMD ich folgendes erhalten:
Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.
C:\Windows\system32>php -c c:\apache24\php7\php.ini -v -display_startup_errors=1
PHP Warning: PHP Startup: Unable to load dynamic library 'c:\apache24\php7\ext\ php_pdo.dll' - %1 is not a valid Win32 application.
in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'c:\apache24\php7\ext\ php_sqlsrv_54_ts.dll' - %1 is not a valid Win32 application.
in Unknown on line 0 PHP
Warning: PHP Startup: Unable to load dynamic library 'c:\apache24\php7\ext\ php_pdo_sqlsrv_54_ts.dll' - %1 is not a valid Win32 application.
in Unknown on line 0
PHP 7.0.10 (cli) (built: Aug 18 2016 09:48:53) (ZTS)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
C:\Windows\system32>
I‘ Auch heruntergeladen und lief SQLSRV32.EXE
innerhalb der C:\Apache24\php7\ext
Ordner.
ich habe:
- Windows Server 2012 RS
- Apache 2.4.23 win64
- PHP 7.0.10 win64
- Microsoft SQL Server 2012 Native Client Win64
- Microsoft Visual C++ Win64 2012 x64 & x86 Redistributables (zwei verschiedene)
- Microsoft Visual C++ 2015 Redistributables (x64 & x86) - 14.0.23026
- Microsoft ODBC-Treiber 11 für SQL Server