Installing PDO driver on MySQL Linux server
On Ubuntu you should be able to install the necessary PDO parts from apt using sudo apt-get install php5-mysql
There is no limitation between using PDO and mysql_ simultaneously. You will however need to create two connections to your DB, one with mysql_ and one using PDO.
That's a good question, but I think you just misunderstand what you read.
Install PDO
The ./config --with-pdo-mysql
is something you have to put on only if you compile your own PHP code. If you install it with package managers, you just have to use the command line given by Jany Hartikainen: sudo apt-get install php5-mysql
and also sudo apt-get install pdo-mysql
Compatibility with mysql_
Apart from the fact mysql_ is really discouraged, they are both independent. If you use PDO mysql_ is not implicated, and if you use mysql_ PDO is not required.
If you turn off PDO without changing any line in your code, you won't have a problem. But since you started to connect and write queries with PDO, you have to keep it and give up mysql_.
Several years ago the MySQL team published a script to migrate to MySQLi. I don't know if it can be customised, but it's official.
At first install necessary PDO parts by running the command
sudo apt-get install php*-mysql
where * is a version name of php like 5.6, 7.0, 7.1, 7.2
After installation you need to mention these two statements
extension=pdo.so
extension=pdo_mysql.so
in your .ini file (uncomment if it is already there) and restart server by command
sudo service apache2 restart
Basically the answer from Jani Hartikainen is right! I upvoted his answer. What was missing on my system (based on Ubuntu 15.04) was to enable PDO Extension in my php.ini
extension=pdo.so
extension=pdo_mysql.so
restart the webserver (e.g. with "sudo service apache2 restart") -> every fine :-)
To find where your current active php.ini file is located you can use phpinfo() or some other hints from here: https://www.ostraining.com/blog/coding/phpini-file/