Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unable to install in ubuntu 22.04 container #1508

Closed
dadamssg opened this issue Apr 8, 2024 · 1 comment
Closed

unable to install in ubuntu 22.04 container #1508

dadamssg opened this issue Apr 8, 2024 · 1 comment

Comments

@dadamssg
Copy link

dadamssg commented Apr 8, 2024

PHP version
8.3

PHP SQLSRV or PDO_SQLSRV version
5.12.0

Microsoft ODBC Driver version
18

Client operating system
ubuntu

Problem description
I'm unable to install the drivers.

Expected behavior and actual behavior
Actual behavior:

2.756 checking how to run the C++ preprocessor... /lib/cpp
2.763 configure: error: in `/tmp/pear/temp/pear-build-defaultuseryxEhPr/sqlsrv-5.12.0':
2.763 configure: error: C++ preprocessor "/lib/cpp" fails sanity check
2.763 See `config.log' for more details
2.774 ERROR: `/tmp/pear/temp/sqlsrv/configure --with-php-config=/usr/bin/php-config' failed

Repro code or steps to reproduce

Dockerfile:

FROM ubuntu:22.04 AS base

ENV DEBIAN_FRONTEND noninteractive

# Install dependencies
RUN apt-get update \
    && apt-get install -y software-properties-common \
    && LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php \
    && apt-get install -yq --no-install-recommends \
        sudo \
        curl \
        php8.3 \
        php8.3-dev \
        php8.3-fpm \
        php8.3-pdo \
        php8.3-xml \
        php8.3-zip \
        php8.3-curl \
        php8.3-gd \
        php8.3-imap \
        php8.3-mcrypt \
        php8.3-mbstring \
        php8.3-soap \
        php8.3-bcmath \
        php8.3-xdebug \
        php8.3-mongodb \
        php8.3-imagick \
        php8.3-redis \
        php-pear \
        nginx \
    && curl https://packages.microsoft.com/keys/microsoft.asc | sudo tee /etc/apt/trusted.gpg.d/microsoft.asc \
    && curl https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list | sudo tee /etc/apt/sources.list.d/mssql-release.list \
    && apt-get update \
    && sudo ACCEPT_EULA=Y apt-get install -y msodbcsql18 mssql-tools18 unixodbc-dev \
    && echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> ~/.bashrc \
    && apt-get autoremove --purge -y \
        software-properties-common \
    && apt-get -y clean \
    && rm -rf /var/lib/apt/lists/* /var/tmp/*

RUN pecl channel-update pecl.php.net \
    && pecl config-set php_ini /etc/php/8.3/fpm/php.ini \
    && pecl install sqlsrv \
    && pecl install pdo_sqlsrv \
    && pecl install xhprof \
    && printf "; priority=20\nextension=sqlsrv.so\n" > /etc/php/8.3/mods-available/sqlsrv.ini \
    && printf "; priority=30\nextension=pdo_sqlsrv.so\n" > /etc/php/8.3/mods-available/pdo_sqlsrv.ini \
    && phpenmod -v 8.3 sqlsrv pdo_sqlsrv

Build:

docker build --no-cache .
@dadamssg
Copy link
Author

dadamssg commented Apr 8, 2024

figure it out by adding build-essential g++.

RUN apt-get update \
    && apt-get install -y software-properties-common build-essential g++ \
    && LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php \
    && apt-get install -yq --no-install-recommends \
        sudo \
        curl \
        php8.3 \
        php8.3-dev \
        php8.3-fpm \
        php8.3-pdo \
        php8.3-xml \
        php8.3-zip \
        php8.3-curl \
        php8.3-gd \
        php8.3-imap \
        php8.3-mcrypt \
        php8.3-mbstring \
        php8.3-soap \
        php8.3-bcmath \
        php8.3-xdebug \
        php8.3-mongodb \
        php8.3-imagick \
        php8.3-redis \
        php-pear \
        nginx \
        supervisor \
        wkhtmltopdf \
        libreoffice \
        wget \
        vim \
    && curl https://packages.microsoft.com/keys/microsoft.asc | sudo tee /etc/apt/trusted.gpg.d/microsoft.asc \
    && curl https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list | sudo tee /etc/apt/sources.list.d/mssql-release.list \
    && apt-get update \
    && sudo ACCEPT_EULA=Y apt-get install -y msodbcsql18 mssql-tools18 unixodbc-dev \
    && echo 'export PATH="$PATH:/opt/mssql-tools18/bin:/usr/sbin"' >> ~/.bashrc \
    && apt-get autoremove --purge -y \
        software-properties-common \
    && apt-get -y clean \
    && rm -rf /var/lib/apt/lists/* /var/tmp/*

RUN pecl channel-update pecl.php.net \
    && pecl config-set php_ini /etc/php/8.3/fpm/php.ini \
    && pecl install sqlsrv \
    && pecl install pdo_sqlsrv \
    && pecl install xhprof \
    && printf "; priority=20\nextension=sqlsrv.so\n" > /etc/php/8.3/mods-available/sqlsrv.ini \
    && printf "; priority=30\nextension=pdo_sqlsrv.so\n" > /etc/php/8.3/mods-available/pdo_sqlsrv.ini \
    && phpenmod -v 8.3 sqlsrv pdo_sqlsrv

@dadamssg dadamssg closed this as completed Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant