问题
I have a VPS with PLESK 12 running on CentOS 6 and I have problem with remote connection to Microsoft SQL Server database with PDO ODBC and PDO DbLib from PHP. I am sure, that connection string is working fine, because my website is working on another Unix VPS with PDO DbLib.
I get this error when I am trying to connect with PDO ODBC:
PDOException: SQLSTATE[IM002] SQLDriverConnect: 0 [unixODBC][Driver Manager]Data source name not found, and no default driver specified
And this when I am trying to connect with PDO DbLib:
PDOException: could not find driver
However, I already tried to install PDO DbLib driver, but it seems, that I didn't do it properly.
Also I checked with PHP, if I can see my remote MSSQL server from the VPS, and it's visible, so the only problem is that driver.
Anyone can guide me how to get it work? Thank you.
回答1:
Most probably you also need the php mssql extension (that allows a php script located on your server to connect to a MsSQL database located on another server). On CentOS you should be able to install it using this command (you have to run it from a ssh shell prompt):
yum -y install php-mssql
The package above is available in the EPEL CentOS repo that can be installed using this command:
yum -y install epel-release
来源:https://stackoverflow.com/questions/41910255/plesk-12-on-centos-6-not-working-pdo-odbc-dblib-drivers