Jump to content

Enabling mssql in php.ini


Recommended Posts

I'm trying to begin rebuilding our web page in php and am having trouble figuring out what needs to be set in the php.ini file to enable MSSQL.

There is no section in the phpinfo() about MSSQL and I read in a few places about enabling MSSQL in the php.ini file.


The MSSQL section contains this:


; Allow or prevent persistent links.

mssql.allow_persistent = On


; Maximum number of persistent links.  -1 means no limit.

mssql.max_persistent = -1


; Maximum number of links (persistent+non persistent).  -1 means no limit.

mssql.max_links = -1


; Minimum error severity to display.

mssql.min_error_severity = 10


; Minimum message severity to display.

mssql.min_message_severity = 10


; Compatibility mode with old versions of PHP 3.0.

mssql.compatability_mode = Off


; Connect timeout

;mssql.connect_timeout = 5


; Query timeout

;mssql.timeout = 60


; Valid range 0 - 2147483647.  Default = 4096.

;mssql.textlimit = 4096


; Valid range 0 - 2147483647.  Default = 4096.

;mssql.textsize = 4096


; Limits the number of records in each batch.  0 = all records in one batch.

;mssql.batchsize = 0


; Specify how datetime and datetim4 columns are returned

; On => Returns data converted to SQL server settings

; Off => Returns values as YYYY-MM-DD hh:mm:ss

;mssql.datetimeconvert = On


; Use NT authentication when connecting to the server

mssql.secure_connection = Off


; Specify max number of processes. -1 = library default

; msdlib defaults to 25

; FreeTDS defaults to 4096

;mssql.max_procs = -1


; Specify client character set.

; If empty or not set the client charset from freetds.comf is used

; This is only used when compiled with FreeTDS

;mssql.charset = "ISO-8859-1"


If I try to connect to our database I get a 500 - Internal server error


Thanks for any help!


Link to comment
Share on other sites

The most important thing in your php.ini file is that you have enabled the php_mssql extension. In the Extensions section you should see this line (uncommented):




After that, getting everything else set up will depend on whether you are on Linux/Apache or Windows/IIS. If you are on Windows, I'd suggest that you use the MSFT-supported extension (sqlsrv). More about that here: http://blogs.msdn.com/b/brian_swan/archive/2010/03/08/mssql-vs-sqlsrv-what-s-the-difference-part-1.aspx. Also, if you are on Windows, using the Web Platform Installer can make set up and configuration easy: http://www.microsoft.com/web/downloads/platform.aspx


Hope that helps.




Link to comment
Share on other sites

This thread is more than a year old.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.