GithubHelp home page GithubHelp logo

PDO is not installed about docker-php-nginx HOT 4 CLOSED

trafex avatar trafex commented on May 28, 2024
PDO is not installed

from docker-php-nginx.

Comments (4)

jordie23 avatar jordie23 commented on May 28, 2024 8

There's a new issue since the user is changed to nobody now. I found this works though (for anyone stumbling upon this thread):

FROM trafex/alpine-nginx-php7
USER root
RUN apk --no-cache add php7-pdo_mysql
USER nobody

from docker-php-nginx.

lmorel3 avatar lmorel3 commented on May 28, 2024

I also tried to install PDO by adding this line RUN apk add --no-cache php7-pdo php7-sqlite3 to my Dockerfile, but it doesn't work. Perhaps, I've the files 00_pdo.ini and 00_sqlite3.ini inside /etc/phpp6/conf.d

I think it could be a good idea to add PDO directly in the project Dockerfile. This library is really often used..

Thanks

from docker-php-nginx.

lmorel3 avatar lmorel3 commented on May 28, 2024

I finally make it work! It was a bit tricky but here's my Dockerfile :

FROM trafex/alpine-nginx-php7
RUN rm -rf /var/www/html/*

RUN apk add --no-cache php7-pdo php7-sqlite3 php7-pdo_sqlite

WORKDIR /var/www/html
COPY app/ /var/www/html/

For MySQL, simply add php7-pdo_mysql, not simply php7-mysql ... !

Hope it'll help you.

from docker-php-nginx.

TrafeX avatar TrafeX commented on May 28, 2024

Yes that should do it! 👍
Although you don't need to add the dependencies yourself (like php-7-pdo and php7-sqlit3). You can just add one of these packages: https://pkgs.alpinelinux.org/packages?name=php7-pdo_*&branch=edge&arch=x86_64 to include the desired database API.

This example Dockerfile already includes php7-mysqli to communicate with a database so I will not add PDO to it as well. If you want to use PDO; add the right package to the Dockerfile and remove php7-mysqli.

If you're not sure what API to use for talking to the database, see this comparison: http://php.net/manual/en/mysqlinfo.api.choosing.php

from docker-php-nginx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.