php: Can't install pdo_psql with docker-php-ext-install
I was trying to install pdo_psql
on fpm-alpine
flavour like:
docker-php-ext-install pdo pdo_pgsql
I was getting first the following error:
configure: error: Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path
So I decide to install libpq
:
RUN echo "@edge http://nl.alpinelinux.org/alpine/edge/main" >> /etc/apk/repositories
RUN apk --no-cache add \
libpq@edge
Same error after that and then I try installing postgresql
like:
RUN echo "@edge http://nl.alpinelinux.org/alpine/edge/main" >> /etc/apk/repositories
RUN apk --no-cache add \
postgresql \
libpq@edge
And then getting different error:
configure: error: Unable to build the PDO PostgreSQL driver: a newer libpq is required
That’s why I’m trying with the
edge
version oflibpq
but…
And I’m get stuck in this step not sure what could be wrong but I can’t install pdo_pgsql
btw my infrastructure it’s have one container per thing, so I have a container for nginx
and a container for php-fpm
and another container with postgres
so my goal it’s have everything split between containers
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 25
- Comments: 15 (1 by maintainers)
Commits related to this issue
- add set command set -ex \ && apk --no-cache add \ postgresql-dev https://github.com/docker-library/php/issues/221 — committed to openroom/phpci by 9034725985 7 years ago
- Basecamp - daemon as docker container https://hub.docker.com/_/php/ https://github.com/docker-library/php/issues/221 https://stackoverflow.com/a/39501539 docker-compose -f docker-compose.yml up --bu... — committed to costlocker/integrations by zdenekdrahos 7 years ago
- Another attempt at fixing pdo_pgsql install issue based on https://github.com/docker-library/php/issues/221#issuecomment-254153971. — committed to furkle/twinepm-server-heroku by deleted user 7 years ago
- :whale: Install php-pgsql Without lines 6-8, I get an error `configure: error: Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path` Applied fix suggested in https://github.co... — committed to paxcodes/topanswers by deleted user 4 years ago
- :whale: Install php-pgsql Without lines 6-8, I get an error `configure: error: Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path` Applied fix suggested in https://github.co... — committed to topanswers/topanswers by deleted user 4 years ago
- Remove postgresql-dev after building the driver This reduces the image size in my tests from 426 MB to 110 MB the steps are taken from https://github.com/docker-library/php/issues/221#issuecomment-385... — committed to StefanSchoof/volkszaehler.org by StefanSchoof 3 years ago
- Remove postgresql-dev after building the driver This reduces the image size in my tests from 426 MB to 110 MB the steps are taken from https://github.com/docker-library/php/issues/221#issuecomment-385... — committed to StefanSchoof/volkszaehler.org by StefanSchoof 3 years ago
- Remove postgresql-dev after building the driver (#865) This reduces the image size in my tests from 426 MB to 110 MB the steps are taken from https://github.com/docker-library/php/issues/221#issuec... — committed to volkszaehler/volkszaehler.org by StefanSchoof 3 years ago
The same issue but on
php:5.6-fpm
, notalpine
.The solution as above is:
Ok! fix my issue! 😃
It’s kind of related with this https://bugs.alpinelinux.org/issues/3642 and this https://bugs.alpinelinux.org/issues/4109
And what I did to fix it was install first
postgresql-dev
like so:And that works! 😃 the links suggest that we should have a small package to satisfy that dependency and be able to install the
pdo_psql
I got stuck on the same problem and your comments did help me to get it running, but you do not need to install the complete postgres package, postgres-libs is sufficient (pdo is already installed, but I needed to install the pgsql extension):
If somebody stumbles upon this and you’re using one of the debian based images:
Note: you must leave
libpq5
for the psql extension to function. Its dev headers though are only needed for compiling the php extension and can and should be removed.Thanks @acodercat , your solution is still “doing the trick” if you are using the docker container “php:7.1-cli”.
apt-get install libpq-dev
I now solved it like this:
You probably need to run “apt-get update” first. 😉
@Aliance This also fixes the issue for php:apache 👍