How to fix fatal PDO error during the Magento 2 installation

- Fire development, Magento 2

Magento 2 export CLI

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:

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:

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:

Visit this page to find more information: fatal PDO error displays.