Docker PHP and FreeTDS - can't find freetds in installation directories

I am trying to build my first image that I was looking for from someone else and I am having a problem where the build fails. Looks like the error is here

[91mconfigure: error: Cannot find FreeTDS in known installation directories
[0m
no
checking for PDO_DBLIB support via FreeTDS... yes, shared

      

Docker file

FROM php:5.6.30-apache

ENV DOWNLOAD_URL https://www.limesurvey.org/stable-release?download=2044:limesurvey2647%20170404targz
#php extensions
RUN docker-php-ext-install pdo pdo_mysql pdo_dblib pdo_pgsql \
    && apt-get update && apt-get install -y \
        freetds-bin \
        freetds-dev \
        freetds-common \
        libct4 \
        libsybdb5 \
        tdsodbc \
        libfreetype6-dev \
        libjpeg62-turbo-dev \
        libmcrypt-dev \
        libpng12-dev \
        libldap2-dev \
        zlib1g-dev \
        libc-client-dev \
        libkrb5-dev \
    && docker-php-ext-install -j$(nproc) iconv mcrypt \
    && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
    && docker-php-ext-install -j$(nproc) gd \
    && docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu \
    && docker-php-ext-install ldap \
    && docker-php-ext-install zip \
    && docker-php-ext-configure imap --with-imap-ssl --with-kerberos \
    && docker-php-ext-install imap \
    && rm -rf /var/lib/apt/lists/* \

    #Download and install LimeSurvey
    && curl -SL "$DOWNLOAD_URL" -o /tmp/lime.tar.gz \
    && tar xf /tmp/lime.tar.gz limesurvey --strip-components=1 -C /var/www/html \
    && chown -R www-data:www-data /var/www/html \
    && rm -f /tmp/lime.tar.gz \
    && chmod -R 755 /var/www/html/tmp \
    && chmod -R 755 /var/www/html/upload \
    && chmod -R 755 /var/www/html/application/config \
    && mkdir -p /var/lib/php5 \
    && chown www-data:www-data /var/lib/php5

      

The image uses PHP 5.6.30. How can I get this to see the freetds install?

+3


source to share


1 answer


You need to consider the correct installation order for dependent packages. Your command RUN

is currently installing freetds-{bin,dev}

after command docker-php-ext-install pdo pdo_mysql pdo_dblib pdo_pgsql

. If you change the order of the installation steps, the freetds. Snippet example:

RUN apt-get update && apt-get install -y \
        freetds-bin \
        freetds-dev \
        freetds-common \
        libct4 \
        libsybdb5 \
        tdsodbc \
        libfreetype6-dev \
        libjpeg62-turbo-dev \
        libmcrypt-dev \
        libpng12-dev \
        libldap2-dev \
        zlib1g-dev \
        libc-client-dev \
        ...
    && docker-php-ext-install pdo pdo_mysql pdo_dblib pdo_pgsql \
        ...

      

However, this will not be enough. I got the following error:

configure: error: Could not find /usr/lib/libsybdb.a|so

      



You can find solutions for such problems through Google. In this special case, you need to add a symlink as part of your team RUN

(found at https://github.com/phpbrew/phpbrew/issues/643#issuecomment-165447722 ):

ln -s /path/to/your/libsybdb.a /usr/lib/

      

Similar issues can arise when running through a Dockerfile.

For development, I recommend splitting a huge team RUN

into several dedicated teams RUN

so you don't have to go through each step over and over again. Once you are sure the Dockerfile is working, you can join the teams back into a single command RUN

.

+5


source







All Articles