PHP - Install PHP PDO driver for mySQL MariaDB

by
Jeremy Canfield |
Updated: June 10 2021
| PHP articles
dnf or yum can be used to install the PHP PDO driver for mySQL / MariaDB on a Linux Red Hat distribution (CentOS, Fedora, Red Hat).
dnf install php-mysqlnd
Something like this should be returned. Notice in this example that php-pdo-7.4.19-1.fc34.x86_64 was installed.
Installed:
php-mysqlnd-7.4.19-1.fc34.x86_64
php-pdo-7.4.19-1.fc34.x86_64
The following files should have been installed.
/etc/php.d/20-pdo.ini
/etc/php.d/30-pdo_mysql.ini
/etc/php.d/30-pdo_sqllite.ini
Additionally, phpinfo.php should return something like this.
There is no need to restart PHP or mySQL or MariaDB for this change to take effect.
Did you find this article helpful?
If so, consider buying me a coffee over at