Reputation: 505
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:
I also see, that my php.ini is saved correctly:
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,
Upvotes: 1
Views: 6572
Reputation: 4402
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.
Upvotes: 2