docker add pdo_pgsql without docker-php-ext

339 views Asked by At

I have an issue with my Dockerfile, I want to add pdo_pgsql in my docker but when I add it (as you can see below commented) routes in my project doesnt work, I have a 404 for every routes, without the pdo_pgsql part everything works fine.

Here is the Dockerfile, as you can see I can't use docker-php-ext because I have to start with from debian to be able to downgrade sqlsrv to 2008 and couldn't do it in another way and I can't find anythingon on the internet to install pdo_pgsql without php-ext and couldn't duplicate it (because I'm not that good enough with docker)

FROM debian:buster-slim

RUN  apt-get -y update  && apt-get -y ...
    ... \
    # install PHP
    && apt-get -y install php7.4 php7.4-common \
    && apt-get -y install php7.4-cli php7.4-fpm php7.4-json php7.4-mysql php7.4-zip php7.4-gd php7.4-mbstring php7.4-curl php7.4-xml php7.4-bcmath \
    && apt-get install -y php7.4-dev \
    && apt-get install -y unixodbc-dev \
    && pecl install sqlsrv \
    && pecl install pdo_sqlsrv \
    && printf "; priority=20\nextension=sqlsrv.so\n" > /etc/php/7.4/mods-available/sqlsrv.ini \
    && printf "; priority=30\nextension=pdo_sqlsrv.so\n" > /etc/php/7.4/mods-available/pdo_sqlsrv.ini \
    && phpenmod -v 7.4 sqlsrv pdo_sqlsrv  \
    && ACCEPT_EULA=Y apt-get install -y msodbcsql17 \
    && ACCEPT_EULA=Y apt-get install -y mssql-tools \
    && apt-get install -y apache2 libapache2-mod-php7.4 \
    && a2enmod php7.4 \
    #pgsql
    #&& apt-get -y intall php7.4-pgsql postgresql-client libpq-dev \
    #&& pecl install pgsql \
    #&& pecl install pdo_pgsql \
    #&& printf "; priority=20\nextension=pgsql.so\n" > /etc/php/7.4/mods-available/pgsql.ini \
    #&& printf "; priority=30\nextension=pdo_pgsql.so\n" > /etc/php/7.4/mods-available/pdo_pgsql.ini \
    #&& phpenmod -v 7.4 pgsql pdo_pgsql  \
    # Baisse la version TLS pour pouvoir se connecter à SQL Server 2008
    && sed -i "s/\(MinProtocol *= *\).*/\1TLSv1.0 /" "/etc/ssl/openssl.cnf"  \
    && sed -i "s/\(CipherString *= *\).*/\1DEFAULT@SECLEVEL=1 /" "/etc/ssl/openssl.cnf" \
    && ...

EDIT: I also tried this, I found 3 php.ini files, but again doesn't work

# && apt-get -y intall php7.4-pgsql postgresql-client libpq-dev \
    # && pecl install pgsql \
    # && pecl install pdo_pgsql \
    # && sed -i 's/;extension=pdo_pgsql/extension=pdo_pgsql/g' /etc/php/7.4/apache2/php.ini /etc/php/7.4/fpm/php.ini /etc/php/7.4/cli/php.ini \
    # && sed -i 's/;extension=pgsql/extension=pgsql/g' /etc/php/7.4/apache2/php.ini /etc/php/7.4/fpm/php.ini /etc/php/7.4/cli/php.ini \
0

There are 0 answers