Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

postgresql client - installation on php:5-apache

I work on some old project (Laravel 4.2, php5.6, postgresql) and I wanna to set it up on docker - here is my dockerfile:

FROM php:5-apache

COPY --from=composer:latest /usr/bin/composer /usr/bin/composer

RUN apt-get update

RUN apt-get install -y \
    git \
    nano \
    libpng-dev \
    libmcrypt-dev \ 
    postgresql-dev \  
    zlib1g-dev \
    zip \
    unzip &&\
    a2enmod rewrite

RUN docker-php-ext-install pdo &&\
    docker-php-ext-install pdo_mysql &&\
    docker-php-ext-install pdo_pgsql &&\
    docker-php-ext-install zip &&\
    docker-php-ext-install gd &&\
    docker-php-ext-install pcntl &&\ 
    docker-php-ext-install mcrypt

# COPY php.ini /usr/local/etc/php/php.ini

I get following error:

E: Unable to locate package postgresql-dev

When I change postgresql-dev to postgresql (and change image to FROM php:5-apache-jessie with different combinations: RUN dpkg --configure -a && RUN apt-get -f install && apt-get update && apt-get upgrade -y && apt-get --purge remove postgresql\* I get errors like:

E: Sub-process /usr/bin/dpkg returned an error code (1)

E: Unable to locate package postgresql*

E: Couldn't find any package by glob 'postgresql*'

E: Couldn't find any package by regex 'postgresql*'

You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application.

You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application.

configure: error: Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path

Question: How to install postgres php client drivers properly?

like image 948
Kamil Kiełczewski Avatar asked Aug 30 '18 16:08

Kamil Kiełczewski


1 Answers

In dockerfile change postgresql-dev \ to

libpq-dev \
like image 139
Kamil Kiełczewski Avatar answered Sep 28 '22 10:09

Kamil Kiełczewski