dornc9470 2018-06-02 15:14
浏览 81

PHP MS SQL - 致命错误:调用未定义的函数sqlsvr_connect()

Good morning. I am trying to set up a php development environment but I keep running in circles chasing down answers that have not worked by searching.

The error I get when trying to run the test php file in Php Designer or after saving it and running it in Chrome or Firefox to connect to my local MS SQL Express db is:

Fatal Error: Call to undefined function sqlsvr_connect()

I am using:

  1. Xampp Control Panel V3.2.2
  2. Apache 2.0 Handler
  3. PHP Version 7.2.5 (x86)
  4. MS SQL Express 2017 RTM
  5. Php Designer 8.1.2

What I think are the correct MS SQL drivers for PHP php_pdo_sqlsrv_72_ts_x86.dll and php_sqlsrv_72_ts_x86.dll Both are stored in C:\xampp\php\ext

The code I'm using in the test.php:

$serverName = "DESKTOP-1FK6JRL\\SQLEXPRESS"; //serverName\instanceName
$connectionInfo = array( "Database"=>"testdb", "UID"=>"myusername", "PWD"=>"MyPassword");
$conn = sqlsrv_connect( $serverName, $connectionInfo);

if( $conn ) {
     echo "Connection established.<br />";
}else{
     echo "Connection could not be established.<br />";
     die( print_r( sqlsrv_errors(), true));
}

This is my Apache error log:

[Sat Jun 02 11:00:31.829695 2018] [ssl:warn] [pid 11940:tid 672] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Sat Jun 02 11:00:31.910495 2018] [core:warn] [pid 11940:tid 672] AH00098: pid file C:/xampp/apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[Sat Jun 02 11:00:31.918467 2018] [ssl:warn] [pid 11940:tid 672] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Sat Jun 02 11:00:31.965356 2018] [mpm_winnt:notice] [pid 11940:tid 672] AH00455: Apache/2.4.33 (Win32) OpenSSL/1.1.0h PHP/7.2.5 configured -- resuming normal operations
[Sat Jun 02 11:00:31.965356 2018] [mpm_winnt:notice] [pid 11940:tid 672] AH00456: Apache Lounge VC15 Server built: Mar 28 2018 12:12:41
[Sat Jun 02 11:00:31.966316 2018] [core:notice] [pid 11940:tid 672] AH00094: Command line: 'c:\\xampp\\apache\\bin\\httpd.exe -d C:/xampp/apache'
[Sat Jun 02 11:00:31.972327 2018] [mpm_winnt:notice] [pid 11940:tid 672] AH00418: Parent: Created child process 22396
[Sat Jun 02 11:00:32.801001 2018] [ssl:warn] [pid 22396:tid 744] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Sat Jun 02 11:00:32.873530 2018] [ssl:warn] [pid 22396:tid 744] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Sat Jun 02 11:00:32.921373 2018] [mpm_winnt:notice] [pid 22396:tid 744] AH00354: Child: Starting 150 worker threads.

Here is my php.ini with the extension_dir set to extension_dir="C:\xampp\php\ext"

extension=bz2
extension=curl
extension=fileinfo
extension=gd2
extension=gettext
;extension=gmp
;extension=intl
;extension=imap
;extension=interbase
;extension=ldap
;extension=mbstring
;extension=exif      ; Must be after mbstring as it depends on it
;extension=mysqli
;extension=oci8_12c  ; Use with Oracle Database 12c Instant Client
;extension=odbc
;extension=openssl
;extension=pdo_firebird
extension=php_pdo_sqlsrv_72_ts_x86
extension=php_sqlsrv_72_ts_x86
;extension=php_pdo_mysql
;extension=pdo_oci
;extension=pdo_odbc
;extension=pdo_pgsql
;extension=pdo_sqlite
;extension=pgsql
;extension=shmop

Any help that anyone can give would be GREATLY appreciated. I have tried all types of combinations to no avail.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 c程序不知道为什么得不到结果
    • ¥40 复杂的限制性的商函数处理
    • ¥15 程序不包含适用于入口点的静态Main方法
    • ¥15 素材场景中光线烘焙后灯光失效
    • ¥15 请教一下各位,为什么我这个没有实现模拟点击
    • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
    • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
    • ¥20 有关区间dp的问题求解
    • ¥15 多电路系统共用电源的串扰问题
    • ¥15 slam rangenet++配置