Skip to content

Instantly share code, notes, and snippets.

@ben-albon
Last active October 4, 2024 08:30
Show Gist options
  • Save ben-albon/3c33628662dcd4120bf4 to your computer and use it in GitHub Desktop.
Save ben-albon/3c33628662dcd4120bf4 to your computer and use it in GitHub Desktop.
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
@GithubMrxia
Copy link

Thanks!

@hperrin
Copy link

hperrin commented Apr 10, 2018

Thank you! 😀

@erikverheij
Copy link

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

Thanks 👍

@miqueiaspenha
Copy link

@arturmangabeira
Copy link

thanks, works very well..

@wiredrawing
Copy link

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

@tt4rm1nal
Copy link

Thanks a lot!

@jcelda
Copy link

jcelda commented Sep 12, 2019

Thanks for the snipped. You are great!!!

@MathewBurnett
Copy link

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

@Lepidopterist
Copy link

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

PHP 4.4 :(

@kharbanda14
Copy link

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

thank brow! 👍

@edocollado
Copy link

Thanks 🚀

@bigbear1989
Copy link

so good!

@MMierzynski
Copy link

Thanks 👍

@brutalzinn
Copy link

Dude, thanks very much!

@alfredbez
Copy link

Works also on PHP 8.0 👍

@silasstoffel
Copy link

Works also on PHP 8.1, thanks

@sidneyn
Copy link

sidneyn commented Oct 18, 2023

very much!!

@G3NSVRV
Copy link

G3NSVRV commented Apr 21, 2024

php:8-apache

3.563 E: Unable to locate package docker-php-ext-install
3.563 E: Unable to locate package pgsql
3.563 E: Unable to locate package pdo
3.563 E: Unable to locate package pdo_pgsql

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