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
@jonataa

This comment has been minimized.

Copy link

@jonataa jonataa commented Aug 4, 2016

These snippet was very helpful :)

Thank you!

@vargaslucas

This comment has been minimized.

Copy link

@vargaslucas vargaslucas commented Dec 16, 2016

Thanks man.

@qmachard

This comment has been minimized.

Copy link

@qmachard qmachard commented Jan 6, 2017

Thanks 👍

@dargmuesli

This comment has been minimized.

Copy link

@dargmuesli dargmuesli commented Jul 2, 2017

Very helpful! :)

@otherpirate

This comment has been minimized.

Copy link

@otherpirate otherpirate commented Feb 9, 2018

Thanks!

@IanSmith123

This comment has been minimized.

Copy link

@IanSmith123 IanSmith123 commented Mar 14, 2018

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

@GithubMrxia

This comment has been minimized.

Copy link

@GithubMrxia GithubMrxia commented Mar 19, 2018

Thanks!

@hperrin

This comment has been minimized.

Copy link

@hperrin hperrin commented Apr 10, 2018

Thank you! 😀

@erikverheij

This comment has been minimized.

Copy link

@erikverheij erikverheij commented Apr 11, 2018

thx :)

@obadaro

This comment has been minimized.

Copy link

@obadaro 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

This comment has been minimized.

Copy link

@SiM07 SiM07 commented Apr 23, 2018

👍

@r1williams

This comment has been minimized.

Copy link

@r1williams r1williams 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

This comment has been minimized.

Copy link

@mhsenpc mhsenpc commented Sep 12, 2018

perfectly worked on php:7.1-apache.
thanks

@murtuzamvista

This comment has been minimized.

Copy link

@murtuzamvista murtuzamvista commented Nov 5, 2018

Thanks 👍

@miqueiaspenha

This comment has been minimized.

Copy link

@miqueiaspenha miqueiaspenha commented Nov 23, 2018

@ricardson @obadaro @ben-albon Thanks

@arturmangabeira

This comment has been minimized.

Copy link

@arturmangabeira arturmangabeira commented Feb 12, 2019

thanks, works very well..

@thousandvicky

This comment has been minimized.

Copy link

@thousandvicky thousandvicky commented Mar 22, 2019

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

@tt4rm1nal

This comment has been minimized.

Copy link

@tt4rm1nal tt4rm1nal commented Mar 26, 2019

Thanks a lot!

@jcelda

This comment has been minimized.

Copy link

@jcelda jcelda commented Sep 12, 2019

Thanks for the snipped. You are great!!!

@MathewBurnett

This comment has been minimized.

Copy link

@MathewBurnett MathewBurnett commented Sep 12, 2019

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

@Lepidopterist

This comment has been minimized.

Copy link

@Lepidopterist 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

This comment has been minimized.

Copy link

@CDRO CDRO commented Dec 9, 2019

Thanks mate.

@LocDoPhuoc

This comment has been minimized.

Copy link

@LocDoPhuoc LocDoPhuoc commented Mar 16, 2020

PHP 4.4 :(

@kharbanda14

This comment has been minimized.

Copy link

@kharbanda14 kharbanda14 commented Apr 5, 2020

Thanks a lot !!

@aspirebj

This comment has been minimized.

Copy link

@aspirebj 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

This comment has been minimized.

Copy link

@richb201 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

This comment has been minimized.

Copy link

@CDRO 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

This comment has been minimized.

Copy link

@denjakah denjakah commented Jul 26, 2020

thank brow! 👍

@aedork

This comment has been minimized.

Copy link

@aedork aedork commented Oct 26, 2020

Thanks 🚀

@bigbear1989

This comment has been minimized.

Copy link

@bigbear1989 bigbear1989 commented Nov 17, 2020

so good!

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