I have created a new account just for this damn problem.
I have created a local web server in my raspberry, using Docker i created a composer with phpmyadmin, mariadb, php 8.2
Everything was working perfectly but then the db connector mysqli did not work:
I get always this message:
Fatal error: Uncaught Error: Class “mysqli” not found in /var/www/html/Example/loginConfirmation.php:10 Stack trace: #0 {main} thrown in /var/www/html/Example/loginConfirmation.php on line 10
the docker-compose.yml:
version: '3.1'
services:
web:
image: php:8.2-apache
ports:
- "80:80"
depends_on:
- db
volumes:
- ./html:/var/www/html/
container_name: web
db:
image: mariadb:10.6
restart: always
environment:
MYSQL_ROOT_PASSWORD: prova1
MYSQL_DATABASE: db_utenti
MYSQL_USER: root
phpmyadmin:
image: phpmyadmin
restart: always
ports:
- "8080:80"
environment:
- PMA_ARBITRARY=1
and the dockerfile:
FROM php:8.2-apache
RUN docker-php-ext-install mysqli
COPY ./html /var/www/html/
RUN a2enmod rewrite
RUN chown -R www-data:www-data /var/www/html
something to understand:
-I am really new to Docker so you should not omit anything (I could have failed trivial things)
-I tried to install mysqli even in a non-docker enviroment with apt-get install mysqli but it still didnt work.
Thanks a lot to everyone!
I tried with different types of composer and dockerfile, I also tried searching for my problem but everything I’ve found online didnt work, I even used chatgpt to help me with this but nothing it only made me troubles.
Berny is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.