本文介绍了在Ubuntu Server上将PHP PDO转换为MS SQL Server的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用PDO连接到MS SQL Server.我已经尝试过使用
I am trying to use PDO to connect to a MS SQL Server. I have tried using this
$db = new PDO("sqlsrv:server=server;database=databaseName", "username", "password");
我正在阅读不再支持sqlsrv.我尝试使用dblib,但这不起作用.
I was reading that sqlsrv is no longer supported. I tried using dblib but that is not working.
我想使用PDO,因为它可以与各种数据库一起使用,但是我似乎无法使其与MS SQL一起使用.
I wanted to use PDO because it is supposed to work with various databases but I cannot seem to get it to work with MS SQL.
在Ubuntu上将PDO与SQL Server一起使用的最佳方法是什么?
What is the best way to use PDO with SQL Server on Ubuntu?
任何帮助都会很棒.
谢谢
推荐答案
我知道了.我想我忘记了我从未在该服务器上安装SQL/Sybase驱动程序.
I figured it out. I guess I forgot that I never installed the SQL/Sybase drivers on this server.
我安装了它:
sudo apt-get install php5-sybase
现在我可以使用:
$db = new PDO("dblib:host=sever;dbname=dbname", "username", "password");
现在运行良好.
这篇关于在Ubuntu Server上将PHP PDO转换为MS SQL Server的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!