Installing PHP Extension in WP ENV

I need pdo_mysql php extension to use on my WordPress plugins. After a day of research, I found out that this is the limitation of wp-env. The developers do not want us to touch more to any setting of PHP and Docker. So we have to manually install everytime after wp-env start. You can use this way to install other php extensions.

Install pdo_mysql after WP-ENV started.

wp-env start
docker ps
docker exec -it [WORDPRESS_CONTAINER_ID] docker-php-ext-install pdo_mysql
docker exec -it [WORDPRESS_CONTAINER_ID] /etc/init.d/apache2 reload

Bash script

#!/bin/bash
CONTAINER_ID="$(docker ps | grep _wordpress_  | awk '{print $1}')"
docker exec -it $CONTAINER_ID docker-php-ext-install pdo_mysql
docker exec -it $CONTAINER_ID /etc/init.d/apache2 reload

References

Tags:

Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.