开发者

Microsoft PHP SQL Driver vs PHP SQL Driver

So on my test machine, I had PHP installed with Apache, and I had the PHP SQL Driver (not the Microsoft one). So, I used mssql_connect() and such commands to deal with the database.

When I shifted to another server, it has Microsoft PHP SQL Driver. Now it is crashing and showing me error of PHP_via_FastCGI error, whenever I execute the mssql_connect() and the other mssql_ php commands.

Could you please advise on how to solve this? Do I need to change my code to something else? If that is the case, I have hundreds of files, do I need to ch开发者_如何转开发ange in each?

Thanks.


You will need to map (change) all the DB calls in the application to the Microsoft driver's equiv functions or create an abstraction layer. An abstraction layer is where you make up your own db functions like: myConnect(...) myEXEC(...)

and within that you have code like

if ($givenDriver=='M') { 
    code using microsoft DB function 
} elseif ($givenDriver=='P') { 
    code using the PHP DB function 
} else { 
    error unknown connection type
}

then everywhere in your code convert from the actual PHP driver commands to your abstraction layer commands. Then the code can easily switch between using one driver or another by changing the value of $givenDriver.


Those two drivers have nothing in common (apart from allowing to interact with SQL Server). They have different function names and functionality. Your program requires the PHP SQL Driver and will not run with the Microsoft one unless you completely rewrite it.

(Whatever, the Microsoft library is pretty good.)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜