我想通过 XAMPP 连接本地计算机上的 SQL Server。为此,我使用了以下规范:
- XAMPP
- PHP 7.0.15
- SQL Server 2012
我已经安装了来自 here 的驱动程序和 here .我还在 x86(32 位)版本中链接了非线程安全驱动程序 php_sqlsrv_7_nts_x86.dll
。当我现在通过 XAMPP 控制面板启动 apache 服务器时,它在 apache 的 error_log
中给我一个错误。
PHP Warning: PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext\php_sqlsrv_7_nts.dll' - Das angegebene Modul wurde nicht gefunden.\r\n in Unknown on line 0
这是一条德语错误消息,表示未找到该模块。
这是我的 php.ini 文件,它将被加载:
extension_dir="C:\xampp\php\ext"
...
extension=php_pdo_sqlsrv_7_nts.dll
extension=php_sqlsrv_7_nts.dll
extension=php_bz2.dll
extension=php_curl.dll
extension=php_fileinfo.dll
;extension=php_ftp.dll
extension=php_gd2.dll
extension=php_gettext.dll
;extension=php_gmp.dll
;extension=php_intl.dll
;extension=php_imap.dll
;extension=php_interbase.dll
;extension=php_ldap.dll
extension=php_mbstring.dll
extension=php_exif.dll ; Must be after mbstring as it depends on it
extension=php_mysqli.dll
;extension=php_oci8_12c.dll ; Use with Oracle Database 12c Instant Client
;extension=php_openssl.dll
;extension=php_pdo_firebird.dll
extension=php_pdo_mysql.dll
;extension=php_pdo_oci.dll
;extension=php_pdo_odbc.dll
;extension=php_pdo_pgsql.dll
extension=php_pdo_sqlite.dll
;extension=php_pgsql.dll
;extension=php_shmop.dll
所以dll文件位于默认的ext
文件夹下。出了什么问题?
我想一定是有问题,apache没有找到dll文件。但是在资源管理器中,dll文件与我在php.ini中写的同名。
最佳答案
如果您在启动 Apache 时遇到 PHP 启动错误,这意味着您正在将 PHP 作为 Apache 模块运行。在这种情况下,您应该使用 PHP 的线程安全版本,如 Windows download 中所述。页:
With Apache you have to use the Thread Safe (TS) versions of PHP.
TS refers to multithread capable builds. NTS refers to single thread only builds. Use case for TS binaries involves interaction with a multithreaded SAPI and PHP loaded as a module into a web server. For NTS binaries the widespread use case is interaction with a web server through the FastCGI protocol, utilizing no multithreading (but also for example CLI).
关于PHP 启动 : Unable to load dynamic library 'C:\\xampp\\php\\ext\\php_sqlsrv_7_nts.dll' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42784223/