Answer the question
In order to leave comments, you need to log in
How to solve PHP Warning: PHP Startup: Unable to load dynamic library 'pdo_pgsql.so' error with Postgresql in Docker?
docker-compose.yml
FROM php:7.4-fpm-alpine
# Set ENVIRONMENT="production" for production
ARG ENVIRONMENT="development"
ENV DEPENDENSIES="git curl openssh-client icu-dev libxml2-dev libxslt-dev libzip-dev espeak"
ENV BUILD_DEPENDENSIES="g++ make autoconf postgresql-dev"
ENV EXTENSIONS="pgsql pdo pdo_pgsql soap intl zip xsl bcmath xml sockets"
ENV COMPOSER_VERSION="1.8.0"
RUN apk update && apk upgrade \
&& apk add --no-cache --virtual .build-deps ${PHPIZE_DEPS} ${BUILD_DEPENDENSIES} \
&& apk add --no-cache ${DEPENDENSIES} \
&& docker-php-ext-install ${EXTENSIONS} \
#&& docker-php-ext-configure pgsql -with-pgsql=/usr/local/pgsql \
&& apk del .build-deps \
&& rm -rf /tmp/* \
&& rm -rf /var/cache/apk/*
# INSTALL composer
RUN mkdir /etc/composer \
&& wget https://getcomposer.org/installer -P /etc/composer \
&& cd /etc/composer && php ./installer --filename=composer --verion=${COMPOSER_VERSION} --install-dir=/bin \
&& rm /etc/composer/installer \
&& chmod a+x /bin/composer
# INSTALL xdebug
RUN if [ "$ENVIRONMENT" == "development" ]; then \
pecl channel-update pecl.php.net \
&& apk add --no-cache --virtual .build-deps ${PHPIZE_DEPS} ${BUILD_DEPENDENSIES} \
&& apk add --no-cache ${DEPENDENSIES} \
&& pecl install xdebug-3.0.1 \
&& docker-php-ext-enable xdebug \
&& echo "xdebug.mode=debug" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo "xdebug.start_with_request=yes" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo "xdebug.client_port=9000" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo "xdebug.remote_handler=dbgp" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo "xdebug.discover_client_host=1" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo "xdebug.idekey=PHPSTORM" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& rm -rf /tmp/* \
;fi
COPY init-php.sh /init.sh
ENTRYPOINT ["/init.sh"]
PHP Warning: PHP Startup: Unable to load dynamic library 'pdo_pgsql.so' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20190902/pdo_pgsql.so (Error loading shared library libpq.so.5: No such file or directory (needed by /usr/local/lib/php/extensions/no-debug-non-zts-20190902/pdo_pgsql.so)), /usr/local/lib/php/extensions/no-debug-non-zts-20190902/pdo_pgsql.so.so (Error loading shared library /usr/local/lib/php/extensions/no-debug-non-zts-20190902/pdo_pgsql.so.so: No such file or directory)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'pgsql.so' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20190902/pgsql.so (Error loading shared library libpq.so.5: No such file or directory (needed by /usr/local/lib/php/extensions/no-debug-non-zts-20190902/pgsql.so)), /usr/local/lib/php/extensions/no-debug-non-zts-20190902/pgsql.so.so (Error loading shared library /usr/local/lib/php/extensions/no-debug-non-zts-20190902/pgsql.so.so: No such file or directory)) in Unknown on line 0
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question