The problem was that I was using the plain PHP image directly, and the mysqli
extension was not included inside the PHP container. To fix this, we need to install the mysqli
extension. There are two ways to do this:
1, Manually Install mysqli
in the Running Container
Start the PHP container.
Access the container’s CLI:
docker exec -it <php-container> bash
Install the mysqli
extension using:
docker-php-ext-install mysqli
Restart the container to apply the changes.
Note: This method is temporary, and the changes will be lost if the container is rebuilt.
2, Build a Custom Docker Image with mysqli
Pre-installed
Create a custom Docker image that automatically installs and enables the mysqli
extension.
This ensures that the extension is always available, and no manual installation is needed each time the container is run.
I ended up going with the second approach, creating a custom Docker image, which solved the problem and ensured everything works smoothly.
Thanks to everyone!!