Edit - Solved
Ignore this, it was nothing to do with the version, but the location with an errant php.ini file.
I’ve been making a bit more progress setting up Docker environments. I got some sites and apps set up and working. I had things set up and working on the latest PHP 8.2, which was interesting, as it seems stricter than previous version and pointed out how sloppy some of my code is, making me fix lots or warnings. But that’s another story.
After doing that, I’m now working on more accurately matching the actual host servers that the production sites are on. One site is running on PHP 8.0, which is the latest the host currently has to offer.
When I set that going in Docker I can’t get a PDO connection.
PDOException: could not find driver in /var/www/.private/sqlcon/connect.php:15 Stack trace: #0 /var/www/.private/sqlcon/connect.php(15): PDO->__construct('mysql:host=...
When I check
phpinfo() I don’t see
pdo_mysql in there.
In PHP 8.2 it’s there and works.
The Dockerfile is like:-
FROM php:8.0-apache RUN a2enmod rewrite RUN service apache2 restart RUN docker-php-ext-install pdo pdo_mysql RUN pecl install xdebug && docker-php-ext-enable xdebug
The only difference between the dockerfiles of the working/non-working sites are the PHP version numbers on the first line. I don’t see any errors during
up so I’m not sure why I’m not getting the driver.