2

I want to connect an SQL Server on my local computer via XAMPP. For that, I am using the following specs:

  • XAMPP
  • PHP 7.0.15
  • SQL Server 2012

I already installed the drivers from here and here. I also linked the Non thread safe driver php_sqlsrv_7_nts_x86.dll in the x86 (32-Bit) version. When I now start the apache server via the XAMPP Control Panel, it gives me an error in the error_log from apache.

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

This is a german error message and means that the module was not found.

This is my php.ini file, which will be loaded:

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

So the dll file is located under the default ext folder. What is going wrong?

I think there must be a problem, that apache didn't find the dll file. But in the explorer, the dll file has the same name as I write in the php.ini.

4
  • Possible duplicate of php 7 unable to initialize sqlsrv Commented Mar 14, 2017 at 11:09
  • But I have done this steps. I don't know why apache don't find my dll. Commented Mar 14, 2017 at 11:13
  • 1
    I am pretty sure you have to use the Thread Safe version with XAMPP on windows and not the NTS version Commented Mar 14, 2017 at 11:27
  • Thank you very much, that was the answer. I heard from an earlier question, that XAMPP uses Non Thread safe. Commented Mar 14, 2017 at 11:31

1 Answer 1

6

If you get a PHP startup error when you start Apache that means you are running PHP as Apache module. In such case, you should be using the thread-safe version of PHP, as explained in the Windows download page:

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).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.