I am trying to migrate form using mysql to PDO, the following code is meant to make a connection
try{
$DBH = new PDO("mssql:host=".DB_SERVER.";dbname=".DB_NAME, DB_USER, DB_PASS);
}
catch(PDOException $e) {
echo "Error: <br>";
echo $e->getMessage();
}
Running the php file will print out
Error:
could not find driver
I have tried doing the following in putty
sudo apt-get update
sudo apt-get install php5-mysql
sudo pecl install pdo_mysql
sudo /etc/init.d/apache2 restart
And I have added the following lines in php.ini
extension=pdo.so
extension=pdo_mysql.so
yet I still get the error, what could I be missing?
You are using MsSQL in your code but installing MySQL driver, or did I miss somethng?
Install PDO http://php.net/manual/en/pdo.drivers.php but according to http://php.net/manual/en/ref.pdo-sqlsrv.php the driver is only availible to Windows installation.