0

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 \
Kenyuki
  • 65
  • 1
  • 7
  • Why do you need to support both SQL Server 2008 and PostgreSQL? – Phil Sep 20 '22 at 09:03
  • because I have to use an old server with sqlsrv 2008 (it is being removed but I need for now to be able to use both, then I will remove it too and make a Dockerfile with "from php:..." but for now I have no choice) – Kenyuki Sep 20 '22 at 12:23
  • FYI there's an official PHP+Apache docker image based on Debian Buster - `php:apache-buster` – Phil Sep 21 '22 at 02:30
  • You don't understand man... I can't change it right now, I will use it later but for now I can't til we move to the new db then I will remake all the Dockerfile – Kenyuki Sep 21 '22 at 05:36
  • You're right, I don't understand. You said you need to use Debian Buster, correct? If so, you can still use the PHP utilities like `docker-ext-php` by using one of the official PHP `-buster` images. If none of this is actually the case, you need to [edit] your question to make it clear – Phil Sep 21 '22 at 05:46
  • oh wait, sorry I think it was me not understanding, so if I change ```FROM debian:buster-slim``` to ```php:apache-buster``` I don't have to change anything? (yeah I am not a docker pro) I think I just can delete the lines where I install php and apache then? – Kenyuki Sep 21 '22 at 06:08
  • Yes but you probably would would want to change _some_ things such as using `docker-ext-php` to install `pdo_pgsql` – Phil Sep 21 '22 at 06:09

0 Answers0