Missing PDO_MySQL in Docker

PHP Extensions

When using the PHP image inside of Docker, there are some extra steps needed when using certain PHP “Core” Extensions. 

If you see errors related to 'PDO_MySQL' you may be missing the Docker extension.
You can find more about extensions here: PHP: Membership - Manual
Here is the page for PDO_MySQL: PHP: MySQL (PDO) - Manual

The PHP page on Dockerhub has examples of installing these extensions
https://hub.docker.com/_/php/
If you scroll way down to PHP Core Extensions You can see an example of installing an extension.

RUN docker-php-ext-install -j$(nproc) iconv mcrypt

You will also need to enable it via

docker-php-ext-enable pdo_mysql

 

Example:

steps:
- run:
name: Install PHP extensions
command: |
sudo docker-php-ext-install pdo_mysql
sudo docker-php-ext-enable pdo_mysql
Was this article helpful?
16 out of 48 found this helpful

Comments

0 comments

Article is closed for comments.