- Joined
- Feb 6, 2011
- Messages
- 225
- Reaction score
- 57
So guys, I regularly browse this forum, and I saw countless questions like this:
"help, my MUCore/MUWeb/whatever web service is giving me errors such like Warning:mssql_connect....."
The reason is that newer PHP versions has ended support of MSSQL plugin on Windows, and Microsoft took over and released their own plugin.
However, this plugin use a different sets of methods to manage MSSQL server, so if a web developer never bother to update them in newer standards you're screwed with a script that would never work.
Technically, you could use a php_mssql.dll from an earlier version of PHP. However, to make that work, you need to give IUSR reading and writing rights to your MSSQL installation. which is very, very dangerous. I won't suggest anybody with a sane mind to do that.
The best way, is to connect using the native ODBC libraries. But after seeing a very recent engine still stick with mssql libraries, I started to research for something that still give support for these methods while usable on newer PHP versions without hassle.
And my research turned up to be not in vain as I finally found a solution.
Somebody has written a re-implementation of C libraries originally marketed by Sybase and Microsoft SQL Server called FreeTDS. And people at Moodle (a CMS Engine that also uses MSSQL and PHP) compiled that into a version that can be used in Windows.
Original post at Moodle here:
To put it simple:
1.download the recompiled plugin according to your version:
PHP5.2(TS):
PHP5.2(NTS):
PHP5.3(TS):
PHP5.3(NTS):
PHP5.4(TS):
PHP5.4(NTS):
PHP5.5(TS):
PHP5.5(NTS):
After you get the package, there should be a dll named php_dblib.dll. Put it in your PHP/ext/.
2.Create a config file called freetds.conf under your C:\ , put the following in it.
HOST and PORT is your MSSQL's Hostname and Port.
if you have multiple instances, put instance = xxx (instance name, e.g. INST2) under port.
3.Go to your PHP,INI (Or IIS PHP Manager), first disable anything that's related to original MSSQL.
Then, enable php_dblib.dll.
4.You're done, now everything related to the mssql methods would operate normally.
"help, my MUCore/MUWeb/whatever web service is giving me errors such like Warning:mssql_connect....."
The reason is that newer PHP versions has ended support of MSSQL plugin on Windows, and Microsoft took over and released their own plugin.
However, this plugin use a different sets of methods to manage MSSQL server, so if a web developer never bother to update them in newer standards you're screwed with a script that would never work.
Technically, you could use a php_mssql.dll from an earlier version of PHP. However, to make that work, you need to give IUSR reading and writing rights to your MSSQL installation. which is very, very dangerous. I won't suggest anybody with a sane mind to do that.
The best way, is to connect using the native ODBC libraries. But after seeing a very recent engine still stick with mssql libraries, I started to research for something that still give support for these methods while usable on newer PHP versions without hassle.
And my research turned up to be not in vain as I finally found a solution.
Somebody has written a re-implementation of C libraries originally marketed by Sybase and Microsoft SQL Server called FreeTDS. And people at Moodle (a CMS Engine that also uses MSSQL and PHP) compiled that into a version that can be used in Windows.
Original post at Moodle here:
You must be registered to see links
To put it simple:
1.download the recompiled plugin according to your version:
PHP5.2(TS):
You must be registered to see links
PHP5.2(NTS):
You must be registered to see links
PHP5.3(TS):
You must be registered to see links
PHP5.3(NTS):
You must be registered to see links
PHP5.4(TS):
You must be registered to see links
PHP5.4(NTS):
You must be registered to see links
PHP5.5(TS):
You must be registered to see links
PHP5.5(NTS):
You must be registered to see links
After you get the package, there should be a dll named php_dblib.dll. Put it in your PHP/ext/.
2.Create a config file called freetds.conf under your C:\ , put the following in it.
Code:
[global]
host = localhost
port = 1433
tds version = 8.0
text size = 20971520
if you have multiple instances, put instance = xxx (instance name, e.g. INST2) under port.
3.Go to your PHP,INI (Or IIS PHP Manager), first disable anything that's related to original MSSQL.
Then, enable php_dblib.dll.
4.You're done, now everything related to the mssql methods would operate normally.