1

I'm trying to run a CodeIgniter application (PHP framework) on a Docker container and I'm getting this error:

Message: PHP Startup: Unable to load dynamic library 'pgsql' 
(tried: /usr/local/lib/php/extensions/no-debug-non-zts-20190902/pgsql 
(/usr/local/lib/php/extensions/no-debug-non-zts-20190902/pgsql: 
cannot open shared object file: No such file or directory), 
/usr/local/lib/php/extensions/no-debug-non-zts-20190902/pgsql.so 
(/usr/local/lib/php/extensions/no-debug-non-zts-20190902/pgsql.so:
 cannot open shared object file: No such file or directory))

And therefor, this one:

Message: Call to undefined function pg_pconnect()

This is my Dockerfile:

FROM php:7.4.1-apache
RUN apt-get update && apt-get install -y libpq-dev
RUN docker-php-ext-configure pgsql -with-pgsql=/usr/local/lib/php/extension/pgsql
RUN docker-php-ext-install pdo pdo_pgsql

COPY . /var/www/html
COPY php.ini-production /usr/local/etc/php/php.ini

RUN service apache2 restart

EXPOSE 80

On the php.ini I have the extension enabled like this:

;extension=pdo_odbc
extension=pdo_pgsql
;extension=pdo_sqlite
extension=pgsql
;extension=shmop

And if I visit my info.php site, I see the extensions are enabled:

enter image description here

I also see, that my php.ini is saved correctly:

enter image description here

I have tried a lot of suggestions from different posts, but havn't been successful at all.

Does someone know where the issue might be?

Thanks,

1
  • Try pgsql in line docker-php-ext-install pgsql pdo_pgsql. Commented Jun 19, 2020 at 11:35

1 Answer 1

2

How I wrote into the comment you need add pgsql:

FROM php:7.4.1-apache
RUN apt-get update && apt-get install -y libpq-dev
RUN docker-php-ext-install pgsql pdo pdo_pgsql

COPY . /var/www/html/

RUN service apache2 restart

EXPOSE 80

I checked this config it's work fine.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.