title: PHP MS SQL - Fatal Error: Call to undefined function sqlsvr_connect()
body: <p>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.</p>
  
  <p>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:</p>
  
  <blockquote>
    <p>Fatal Error: Call to undefined function sqlsvr_connect()</p>
  </blockquote>
  
  <p>I am using:</p>
  
  <ol>
  <li>Xampp Control Panel V3.2.2</li>
  <li>Apache 2.0 Handler</li>
  <li>PHP Version 7.2.5 (x86)</li>
  <li>MS SQL Express 2017 RTM</li>
  <li>Php Designer 8.1.2</li>
  </ol>
  
  <p><a href="https://i.stack.imgur.com/Uk8Ma.png" rel="nofollow noreferrer">What I think are the correct MS SQL drivers for PHP</a> php_pdo_sqlsrv_72_ts_x86.dll and php_sqlsrv_72_ts_x86.dll Both are stored in C:\xampp\php\ext</p>
  
  <p>The code I'm using in the test.php:</p>
  
  <pre><code>$serverName = "DESKTOP-1FK6JRL\\SQLEXPRESS"; //serverName\instanceName
  $connectionInfo = array( "Database"=&gt;"testdb", "UID"=&gt;"myusername", "PWD"=&gt;"MyPassword");
  $conn = sqlsrv_connect( $serverName, $connectionInfo);
  
  if( $conn ) {
       echo "Connection established.&lt;br /&gt;";
  }else{
       echo "Connection could not be established.&lt;br /&gt;";
       die( print_r( sqlsrv_errors(), true));
  }
  </code></pre>
  
  <p>This is my Apache error log:</p>
  
  <pre><code>[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.
  </code></pre>
  
  <p>Here is my php.ini with the extension_dir set to extension_dir="C:\xampp\php\ext"</p>
  
  <pre><code>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
  </code></pre>
  
  <p>Any help that anyone can give would be GREATLY appreciated. I have tried all types of combinations to no avail.</p>