Missing PDO
BloomyInDev opened this issue · 8 comments
Hey,
I've started to use your container but it seems that you don't have installed the optional package php81-pdo so i can't use the PDO class.
Can you add it to the container ?
Have a good day
If you want, i can make a pull request to add this
Hi @BloomyInDev ,
Thank you for the suggestion. This container is meant as an example which you copy and paste to adjust to your needs.
Therefore, it's not a all-in-one solution that has all the PHP extensions and I don't want to add more.
You can either extend from this image and install the needed extensions in your own image, or completely copy/paste it.
@BloomyInDev example dockerfile
FROM trafex/php-nginx:latest
USER root
RUN apk add --no-cache php83-pdo_mysql php83-pdo_sqlite # plus whatever other extensions you need
USER nobody
I already did a clone. It was just if it was intentional or not
Anyway thanks
@BloomyInDev example dockerfile
FROM trafex/php-nginx:latest USER root RUN apk add --no-cache php83-pdo_mysql php83-pdo_sqlite # plus whatever other extensions you need USER nobody
How would one go about using that with Docker-Compose.yaml ?
Edit:
docker exec -it --user=root <containername> /bin/sh Helps to get in as root and run apk add.
@BloomyInDev example dockerfile
FROM trafex/php-nginx:latest USER root RUN apk add --no-cache php83-pdo_mysql php83-pdo_sqlite # plus whatever other extensions you need USER nobodyHow would one go about using that with Docker-Compose.yaml ?
This is a Dockerfile so you need to build it before
No you dont.
version: "3.8"
services:
app:
image: trafex/php-nginx
container_name: containername
user: root
command: sh -c "apk add --no-cache php84-pdo_mysql php84-pdo"
ports:
- "8080:8080"
volumes:
- /mnt/docker/web:/var/www/html
restart: always
You just need to make sure to use correct phpt version... 8.3 or 8.4 for current build.
that another way, i prefer doing it the dockerfile way cuz it wont redo the installation of some packages (here pdo_mysql and pdo)