php pdo driver not found

php connect to mssql database on Linux using pdo: driver not found
php pdo mssql driver installation on centos and ubuntu

If you are using CentOS, fedora or RHEL, Run commands
sudo yum install php-pdo
sudo yum install php-mssql
sudo yum install freetds-devel libxml2-devel
If you are using Debian or Ubuntu, Run

sudo apt-get install php5-dev php5-mysql php5-odbc php5-sybase libmysqlclient-dev freetds-dev

dblib is needed on Linux to connect to mssql server using pdo.

Here is php code to connect to ms sql server from Linux Apache using pdo.
$dsn = 'dblib:dbname=testdb;host=';
$user = 'dbuser';
$password = 'dbpass';
$dbh = new PDO($dsn, $user, $password);
Now try to connect MS SQL server.

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...