E
E
Elena Stepanova2016-07-31 19:43:59
PHP
Elena Stepanova, 2016-07-31 19:43:59

How to install php7 pdo_pgsql via Dockerfile?

Dockerfile

FROM php:7-fpm

ENV PATH $PATH:/root/.composer/vendor/bin

# Install modules
RUN apt-get update && apt-get install -y \
        openssl \
        curl \
        wget \
        git \
        unzip \
        libfreetype6-dev \
        libjpeg62-turbo-dev \
        libmcrypt-dev \
        libpng12-dev \
        libicu-dev \
                --no-install-recommends

RUN docker-php-ext-install mcrypt
RUN docker-php-ext-install intl 
RUN docker-php-ext-install mbstring 
RUN docker-php-ext-install exif 
RUN docker-php-ext-install pdo 
RUN docker-php-ext-install pdo_pgsql
....

When building It comes to installing pdo_pgsql and crashes
....
checking for PostgreSQL support for PDO... yes, shared
checking for pg_config... not found
configure: error: Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path
ERROR: Service 'php' failed to build: The command '/bin/sh -c docker-php-ext-install pdo_pgsql' returned a non-zero code: 1

By searching for libpq-fe.h I found several links
https://github.com/docker-library/php/issues/221 but there for some other Linux
www.tech-notes.net/postgresql-9-4-on -centos-6-5 - but linking makes sense when postgres is installed... but it should be in another container... how right? or install and remove after build extension?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Masterov, 2016-07-31
@Insolita

For Debian or Ubuntu, try installing libpq-dev.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question