PHP postgresql in docker compose

Hello,

I take the liberty of writing to you because I am blocked on a point that you will undoubtedly find basic.

I am unable to activate the php pgsql extension.

I am on an Unbuntu server and here is my docker compose.

Blockquote
version: ‘2’
services:
web:
image: lavoweb/php-7.4
ports:
- “80:80”
volumes:
- /var/www:/var/www/html
- /var/docker/php.ini-development:/usr/local/etc/php/php.ini-development
- /var/docker/php.ini-production:/usr/local/etc/php/php.ini-production
links:
- db:db
db:
image: postgres
restart: always
volumes:
- /mnt/postgresql:/var/lib/postgresql/data
environment:
POSTGRES_PASSWORD: Alcapone!257
PGDATA: /var/lib/postgresql/data/pgdata
adminer:
image: adminer
restart: always
ports:
- 8080:8080

I did add “extension = pgsql.so” in the php.ini, but the “extension_loaded (‘pgsql’)” function tells me that it is not activated.

I don’t know how to install it with my php image.

cordially.

Hi,

resolve with this :

I add this code in image build of php :

RUN docker-php-ext-configure pgsql -with-pgsql=/usr/local/pgsql \
    && docker-php-ext-install pgsql pdo_pgsql

Can you tell more? Where did you add this RUN docker-php-ext-configure pgsql -with-pgsql=/usr/local/pgsql \ && docker-php-ext-install pgsql pdo_pgsql
I can’t understand how add command RUN in docker-compose.