XAMPP,用于 SQL Server 支持的 Microsoft PHP 驱动程序:找不到扩展

问题描述 投票:0回答:1

我在使用 XAMPP 设置服务器时遇到问题。 设置完所有内容后,PHP 抛出一个错误,指出

Call to undefined function sqlsrv_connect()
,经过更多故障排除后,我发现 PHP 找不到扩展。我的 PHP 版本是 8.0.3(顺便说一句,当我运行时
php --version
我得到了这个:

PHP Warning:  PHP Startup: Unable to load dynamic library 'php_sqlsrv_83_ts_x64' (tried: C:\xampp\php\ext\php_sqlsrv_83_ts_x64 (Impossibile trovare la procedura specificata), C:\xampp\php\ext\php_php_sqlsrv_83_ts_x64.dll (Impossibile trovare il modulo specificato)) in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library 'php_sqlsrv_83_ts_x64' (tried: C:\xampp\php\ext\php_sqlsrv_83_ts_x64 (Impossibile trovare la procedura specificata), C:\xampp\php\ext\php_php_sqlsrv_83_ts_x64.dll (Impossibile trovare il modulo specificato)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'php_pdo_sqlsrv_83_ts_x64' (tried: C:\xampp\php\ext\php_pdo_sqlsrv_83_ts_x64 (Impossibile trovare la procedura specificata), C:\xampp\php\ext\php_php_pdo_sqlsrv_83_ts_x64.dll (Impossibile trovare il modulo specificato)) in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library 'php_pdo_sqlsrv_83_ts_x64' (tried: C:\xampp\php\ext\php_pdo_sqlsrv_83_ts_x64 (Impossibile trovare la procedura specificata), C:\xampp\php\ext\php_php_pdo_sqlsrv_83_ts_x64.dll (Impossibile trovare il modulo specificato)) in Unknown on line 0
PHP 8.0.30 (cli) (built: Sep  1 2023 14:15:38) ( ZTS Visual C++ 2019 x64 )
Copyright (c) The PHP Group
Zend Engine v4.0.30, Copyright (c) Zend Technologies

扩展在那里:

以及在right php.ini 文件中激活:

enter image description here

我的分机目录:

extension_dir="C:\xampp\php\ext"

编辑:我注意到我安装了错误的模块版本,所以我将其从 83 版本更改为 80 版本。现在错误消失了,但这个错误仍然存在

Call to undefined function sqlsrv_connect()

php sql-server xampp
1个回答
0
投票

有一整套问题:

  • 首先,安装了错误的模块版本。由于我有 PHP 8.0.3,我必须导入 80 版本的模块,但我安装了 83。
  • 第二,不包含 php8ts.php。
  • 第三,更改模块后,它们的名称也更改了,并且 php.ini 中指定的文件名与实际的文件名不匹配。
© www.soinside.com 2019 - 2024. All rights reserved.