The solution of the error “PDOException “could not find driver””

I noticed somehow the following error:

PDOException “could not find driver”

The reason may be not activated pdo_mysql or not installed php5-mysql.
Let’s look at the PDO:

php -i|grep PDO

In php.ini or connected configuration files there should be a line:

extension=pdo.so
extension=pdo_mysql.so

Let’s see the information about php5-mysql:

dpkg --get-selections | grep php5-mysql

If not installed, then install, in Ubuntu it can be done like this:

sudo apt-get install php5-mysql
sudo apt-get install php-mysql
sudo /etc/init.d/apache2 restart
sudo service apache2 restart

Leave a comment

Leave a Reply