X

Configure PHP to connect to a Microsoft SQL Server

This post hopes to walk you through configuring PHP 5.x to connect to Microsoft SQL Server.  These are the steps that we completed to get this working…

  1. Download unofficial PHP MS SQL extension files from here: https://onedrive.live.com/redir?resid=669EE24817961774%21720
    ­
  2. Extract only the php_sqlsrv_56_ts.dll and php_pdo_sqlsrv_56_ts.dll files to the php\ext folder. Note the ’56’ matches the PHP version installed which is v5.6.  If your version differs use the correct numbers that match your PHP version.
    ­
  3. Add the following to the PHP.ini file…

    [PHP_SQLSRV]
    extension=php_pdo_sqlsrv_56_ts.dll
    extension=php_sqlsrv_56_ts.dll

  1. Test to confirm that driver is now active in PHP by checking phpinfo…
    ­
    Connect PHP with Microsoft SQL Server­
  2. Download and install the 64-bit version of Microsoft SQL 2012 Native Client… http://go.microsoft.com/fwlink/?LinkID=239648&clcid=0x409
    ­
  3. If using Azure, log on to the Azure Portal and edited the SQL Server – Firewall Setting to allow your IP.

Want to speak to us on the phone?

Please contact us and we can discuss your requirements!

High Wycombe & South Bucks

Aylesbury & North Bucks

  • Aylesbury
  • Buckingham
  • Milton Keynes
  • Leighton Buzzard

Thame & Oxfordshire

  • Thame
  • Oxford
  • Witney
  • Didcot

London & Home Counties

  • London
  • Watford
  • Uxbridge
  • Rickmansworth