{"id":46,"date":"2014-02-23T06:35:00","date_gmt":"2014-02-23T06:35:00","guid":{"rendered":"http:\/\/373@jodohost.com\/\/blog\/"},"modified":"2014-02-23T06:35:00","modified_gmt":"2014-02-23T06:35:00","slug":"connecting-php-with-the-mssql-database-on-iis7","status":"publish","type":"post","link":"http:\/\/www.jodohost.com\/blog\/index.php\/2014\/02\/23\/connecting-php-with-the-mssql-database-on-iis7\/","title":{"rendered":"Connecting PHP with the MSSQL database on IIS7"},"content":{"rendered":"<p>Sometimes we have to connect PHP with MSSQL &#8211; most of the webhosts don&#8217;t offer this on a shared environment but it is possible to have this facility on a dedicated server or VPS with the following steps:- <\/p>\n<p>Step 1: Make sure that you&#8217;re running the IIS web server with PHP installed on it.<\/p>\n<p>Step 2: Download\u00a0Microsoft Drivers 3.0 for PHP and the SQL Server on your server and run the file:-<\/p>\n<p>http:\/\/www.microsoft.com\/en-in\/download\/details.aspx?id=20098<\/p>\n<p>Step 3: When prompted, enter the path to the PHP extensions directory &#8211; it&#8217;s recommended by Microsoft to use &#8216;C:\\Program Files&#8217;<\/p>\n<p>Step 4: After extracting the files, copy the dlls from the extracted directory<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br \/>(For non-thread safe)<br \/>php_pdo_sqlsrv_53_nts.dll<br \/>php_sqlsrv_53_nts.dll <\/p>\n<p>(For thread safe)<br \/>php_sqlsrv_53_ts.dll<br \/>php_pdo_sqlsrv_53_ts.dll<br \/>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>to the PHP extensions directory which could be like C:\\PHP\\ext\\ or &#8216;C:\\Program Files x86\\PHP\\ext\\&#8217; on the server.<\/p>\n<p>Note: Read the Installation section of the SQLSRV30_Readme.htm file for more details.<\/p>\n<p>Step 5: Install the Microsoft SQL Server native client as per your MSSQL edition &#8211; 2005 or 2008 or 2012.<\/p>\n<p>Step 6: Enable the sqlsrv extension in the php.ini configuration file of the server, as below:- <\/p>\n<p>extension=php_sqlsrv_53_nts.dll<br \/>extension=php_pdo_sqlsrv_53_nts.dll<\/p>\n<p>Step 7: Then restart the web service or IISRESTART on the server, and then check the phpinfo page and you should be seeing that the sqlsrv section is now being displayed on that page which means that you are now able to connect with the MSSQL database using PHP code.<\/p>\n<p>That&#8217;s all.<\/p>\n<p> ]]><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sometimes we have to connect PHP with MSSQL &#8211; most of the webhosts don&#8217;t offer this on a shared environment but it is possible to have this facility on a dedicated server or VPS with the following steps:- Step 1: Make sure that you&#8217;re running the IIS web server with PHP installed on it. Step [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[2],"tags":[],"_links":{"self":[{"href":"http:\/\/www.jodohost.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/46"}],"collection":[{"href":"http:\/\/www.jodohost.com\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.jodohost.com\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.jodohost.com\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.jodohost.com\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=46"}],"version-history":[{"count":0,"href":"http:\/\/www.jodohost.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/46\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.jodohost.com\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=46"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.jodohost.com\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=46"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.jodohost.com\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=46"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}