Having some issues with Docker WordPress site that I can’t figure out. PDO_MYSQL PHP and a slippery “There has been a critical error on this website”.

So I’m running WordPress with a MariaDB SQL server in Docker for a small business. Everything has been going well except I’ve now got that “There has been a critical error on this website” error when I go to the WooCommerce menu in WordPress. I was able to setup WooCommerce no issues, but when I click on it to look at some of the options, I get the error. I’m also getting the PDO PHP extension error for MailPoet but I didn’t think they were related so I’ve been focusing on the WooCommerce issue. I enabled debugging and when I look at the logs it’s all PHP errors. I get this one over and over

PHP Fatal error: Uncaught Error: Undefined class constant ‘MYSQL_ATTR_INIT_COMMAND’ in /var/www/html/wp-content/plugins/mailpoet/lib/Doctrine/ConnectionFactory.php:84

Anyone know if they’re related and/or how I can narrow down the issue? I’ve been reading forum posts for a couple days and nothing seems to be solving my issue. Some people mentioning using a Dockerfile to install the PHP extension but I can’t do that to a running site.

Edit: It’s also only doing that error when I click on Analytics, Customers, or Home in WooCommerce

Edit: Solved! For anyone who’s reading in the future, I added a Dockerfile to build a new wordpress image for docker compose. I ran the command docker build -t nameforyourimage .. With a period at the end. The Dockerfile contained

FROM wordpress RUN docker-php-ext-install pdo_mysql RUN docker-php-ext-enable pdo_mysql

although I’m not sure the second line was necessary. After that, I changed my docker compose file to use that new image I created. Worked fine after that.

1 Comment
  1. What version of php are you running? The issue is with Mailpoet. If you’re using 8.1 go down to 8, and if that doesn’t work, 7.4.


This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Your Advertisement Here