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
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.
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-develIf 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.
<?php $dsn = 'dblib:dbname=testdb;host=127.0.0.1'; $user = 'dbuser'; $password = 'dbpass'; $dbh = new PDO($dsn, $user, $password); ?>Now try to connect MS SQL server.
No comments:
Post a Comment