Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Docker PHP Image with PostgreSQL Driver
FROM php:5.6-apache
RUN apt-get update && apt-get install -y libpq-dev && docker-php-ext-install pdo pdo_pgsql
COPY src/ /var/www/html
@otherpirate
Copy link

otherpirate commented Feb 9, 2018

Thanks!

@IanSmith123
Copy link

IanSmith123 commented Mar 14, 2018

awesome, just now my script failed because of php5-pgsql was removed? Anyway I delete it and worked :)

@GithubMrxia
Copy link

GithubMrxia commented Mar 19, 2018

Thanks!

@hperrin
Copy link

hperrin commented Apr 10, 2018

Thank you! 😀

@erikverheij
Copy link

erikverheij commented Apr 11, 2018

thx :)

@obadaro
Copy link

obadaro commented Apr 18, 2018

Thanks for sharing.
In my case it was necessary to add the pgsql extension:
docker-php-ext-install pgsql pdo pdo_pgsql

@SiM07
Copy link

SiM07 commented Apr 23, 2018

👍

@r1w1s1
Copy link

r1w1s1 commented Jun 8, 2018

FROM php:7.2.6-apache

RUN apt-get update && apt-get install -y libpq-dev && docker-php-ext-install pdo pdo_pgsql

@mhsenpc
Copy link

mhsenpc commented Sep 12, 2018

perfectly worked on php:7.1-apache.
thanks

@murtuzamvista
Copy link

murtuzamvista commented Nov 5, 2018

Thanks 👍

@miqueiaspenha
Copy link

miqueiaspenha commented Nov 23, 2018

@ricardson @obadaro @ben-albon Thanks

@arturmangabeira
Copy link

arturmangabeira commented Feb 12, 2019

thanks, works very well..

@wiredrawing
Copy link

wiredrawing commented Mar 22, 2019

Thank you.
Completing how to install which you wrote, I succeeded to install pdo_pgsql.

@tt4rm1nal
Copy link

tt4rm1nal commented Mar 26, 2019

Thanks a lot!

@jcelda
Copy link

jcelda commented Sep 12, 2019

Thanks for the snipped. You are great!!!

@MathewBurnett
Copy link

MathewBurnett commented Sep 12, 2019

Brilliant, this has changed everything about the way we work.

@Lepidopterist
Copy link

Lepidopterist commented Sep 12, 2019

I've spent the last nine years searching for this solution. It's the best three lines of config I have ever seen. Thank you.

@CDRO
Copy link

CDRO commented Dec 9, 2019

Thanks mate.

@LocDoPhuoc
Copy link

LocDoPhuoc commented Mar 16, 2020

PHP 4.4 :(

@kharbanda14
Copy link

kharbanda14 commented Apr 5, 2020

Thanks a lot !!

@aspirebj
Copy link

aspirebj commented May 4, 2020

FROM php:7.4.2-apache-buster
RUN apt-get update && apt-get install -y libpq-dev && docker-php-ext-install pdo pdo_pgsql``

@richb201
Copy link

richb201 commented Jun 6, 2020

My Dockerfile uses "FROM bitnami/php-fpm:7.2" rather than the Apache container. So I will use

FROM bitnami/php-fpm:7.2
RUN apt-get update && apt-get install -y libpq-dev && docker-php-ext-install pdo pdo_pgsql

Is this doomed to failure?

@CDRO
Copy link

CDRO commented Jun 8, 2020

My Dockerfile uses "FROM bitnami/php-fpm:7.2" rather than the Apache container. So I will use

FROM bitnami/php-fpm:7.2
RUN apt-get update && apt-get install -y libpq-dev && docker-php-ext-install pdo pdo_pgsql

Is this doomed to failure?

This could work but you'd have to ensure that your apache handles requests to php though PHP-FPM

@denjakah
Copy link

denjakah commented Jul 26, 2020

thank brow! 👍

@edocollado
Copy link

edocollado commented Oct 26, 2020

Thanks 🚀

@bigbear1989
Copy link

bigbear1989 commented Nov 17, 2020

so good!

@MMierzynski
Copy link

MMierzynski commented Jun 26, 2021

Thanks 👍

@brutalzinn
Copy link

brutalzinn commented Nov 15, 2021

Dude, thanks very much!

@alfredbez
Copy link

alfredbez commented Nov 25, 2021

Works also on PHP 8.0 👍

@silasstoffel
Copy link

silasstoffel commented Dec 23, 2021

Works also on PHP 8.1, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment