Plesk 12 on CentOS 6 not working PDO ODBC/DbLib drivers

寵の児 提交于 2019-12-13 07:19:53

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!