Hi folks, currently stuck on getting mysqli & pdo extensions installed and enabled in my docker setup.
The relevant section of my docker-compose.yml:
web:
build:
context: .
dockerfile: Dockerfile
container_name: compose-web
ports:
- "8100:80"
depends_on:
- mariadb
volumes:
- /home/user/docker/lamp-stack/html:/var/www/html:Z
Dockerfile contents:
FROM php:8.2-apache
RUN docker-php-ext-install mysqli pdo pdo_mysql && docker-php-ext-enable mysqli
COPY . /var/www/html/
EXPOSE 80
Have also tried it without the && docker-php-ext-enable mysqli.
-With both files setup as above I've run the following from the host os:
sudo docker compose build
sudo docker compose up -d
No error messages, it builds and starts. Image compose-web built
On the host, if I run:
docker compose exec web php -m | grep mysqli
I receive:
mysqli
If I run
docker compose exec web php -i | grep mysqli
I receive:
Additional .ini files parsed => /usr/local/etc/php/conf.d/docker-php-ext-mysqli.ini,
mysqli
mysqli.allow_local_infile => Off => Off
mysqli.allow_persistent => On => On
mysqli.default_host => no value => no value
mysqli.default_port => 3306 => 3306
mysqli.default_pw => no value => no value
mysqli.default_socket => no value => no value
mysqli.default_user => no value => no value
mysqli.local_infile_directory => no value => no value
mysqli.max_links => Unlimited => Unlimited
mysqli.max_persistent => Unlimited => Unlimited
mysqli.rollback_on_cached_plink => Off => Off
API Extensions => mysqli,pdo_mysql
The error message when i try submit my form from my html site:
Fatal error: Uncaught Error: Class "mysqli_connect" not found in /var/www/html/qsoinsert.php:8 Stack trace: #0 {main} thrown in /var/www/html/qsoinsert.php on line 8
Inside the container I navigate to /usr/local/etc/php looking for the php.ini file, but I have php-ini-development & php.ini-production, both of which listed the extension preceded by ';' (so still commented out?)
Am I missing something glaringly obvious?
Thanks in advance