How to fix fatal PDO error during the Magento 2 installation
Another issue you may face during the Magento 2 installation is the fatal PDO error. Below, we shed light on how to fix it. If you cannot install Magento 2 on the nginx web server, you may find the solution here: How to install Magento 2 using nginx. More useful tips are available here: Magento 2 Cookbook.
The Issue
The following error stops the installation process of Magento 2:
1 |
PHP Fatal error: Class 'PDO' not found in /var/www/html/magento2/setup/module/Magento/Setup/src/Module/Setup/ConnectionFactory.php on line 44 |
What does it mean?
The Solution
The error happens than not all required PHP extensions are installed. Use the following command to see the list of installed modules:
1 |
php -m |
As for the extensions Magento 2 requires, they include the following ones:
- bcmath (Magento 2 Commerce only);
- devel (both Commerce and Open Source);
- gd (both Commerce and Open Source);
- iconv (both Commerce and Open Source);
- intl (both Commerce and Open Source);
- json (both Commerce and Open Source);
- mbstring (both Commerce and Open Source);
- mysql (both Commerce and Open Source);
- mysqlnd (both Commerce and Open Source);
- opcache (both Commerce and Open Source);
- pdo (both Commerce and Open Source);
- soap (both Commerce and Open Source);
- xml (both Commerce and Open Source).
Now, you have to verify whether all of the listed extensions are available in your Magento 2 installation. If any modules are missing, you face the PDO error. To fix the issue, you have to add them using the same workflow you used for installing PHP.
You can use yum to add PHP 7.2 modules to Magento 2 as follows:
1 |
yum -y install php72u-pdo php72u-mysqlnd php72u-opcache php72u-xml php72u-gd php72u-devel php72u-mysql php72u-intl php72u-mbstring php72u-bcmath php72u-json php72u-iconv php72u-soap |
Visit this page to find more information: