4

I'm running an IIS 7 windows server and a relevant part of my phpinfo's configure command currently reports this:

cscript /nologo configure.js ...... "--without-mssql" "--without-pdo-mssql" "--without-pi3web" ...... "--with-mcrypt=static"

What do I need to do to my server so that I can see the with-mssql above as opposed to seeing without-mssql?

I was once told to recompile PHP. That's where the buck stopped. Cause this PHP came with IIS install so we never needed to compile PHP before. Re-compiling... is that a command line thing?

9
  • There is no need to re-compile PHP. Just download a different version. Commented Mar 21, 2012 at 3:34
  • What version of PHP are you using? Commented Mar 21, 2012 at 14:58
  • @brad, how do i make sure that the new version support with mssql. I thought, recompiling php gives the developer a chance the configure the php settings at the dos prompt. Commented Mar 24, 2012 at 20:05
  • @halfer, it's 5.3. We got no apps running on it. One idea to get the mysqli and mssql support it to reinstall. I found this link on micirosft site. microsoft.com/web/gallery/install.aspx?appid=PHP53 Shall I go ahead and install it over the existing version? Will it give me the chance to specify which extensions I want and I don't? Commented Mar 24, 2012 at 20:21
  • I've no idea if it will ask. But I should think you could tweak this in the php.ini if it doesn't. Commented Mar 24, 2012 at 20:30

2 Answers 2

10

Microsoft SQL Server support and extensions are not shipped with PHP anymore. To connect PHP with SQL Server you need Microsoft Drivers for PHP for SQL Server:

The Microsoft Drivers for PHP for SQL Server is a PHP 5 extension that provides data access to SQL Server 2005 and later versions including SQL Azure.

The download page for drivers lists four versions to choose from. Consult the System Requirements page in order to determine which version you need. You must install the correct driver for your Operating System+SQL Server+PHP version combination.

You will also need one of these depending on which driver you choose (these must be installed separately):

  • SQL Server Native Client
  • Microsoft ODBC Driver 11 for SQL Server

The installer simply extracts the files in the specified location. You must the files to PHP extensions directory. The files are PHP extensions. The file names indicate:

  • nts/ts -- should be used with non thread safe/thread safe version of PHP
  • 54/55/56... -- should be used with PHP version 5.4, 5.5, 5.6, ...
  • sqlsrv/pdo_sqlsrv -- provides procedural interface/PDO interface

Enable the extensions in php.ini file making sure that thread safetyness and PHP versions match.

Check phpinfo to see if extensions are loaded. Test sqlsrv_connect("servername") and new PDO("sqlsrv:server=servername") to make sure the extensions are working.

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

4 Comments

load the php_mssql.dll extension to use mssql_* functions ... How do you do that?
@JohnSmith - modify your php.ini to include the line extension=php_mssql.dll - there's a lot of instructions for enabling extensions on the web. If you get stuck, do a web search first, then ask more questions :)
Normally this is done by copying the extension dll file in the c:/php/ext directory and adding a line extension=php_<extname>.dll in php.ini. I have not ever tried loading mssql extension, I therefore suggest that you go through the PHP manual pages about mssql extension, specially through the user contributed notes section.
i have added the extension on php.ini file but it keep on showing he same error.
0

You can solve this problem using PHP Manager in IIS 7.0 Goto PHP Manager ->PHP Extensions->Enable of Disable Extensions ->Disable List Enable your PHP_PDO_SQLSRV_54_ts.dll

will work prefecttly

1 Comment

Probably best not to promise that it will work perfectly - the asker might be in a different situation to you in another way.

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.