mlocati / docker-php-extension-installer

Easily install PHP extensions in Docker containers
MIT License
4.15k stars 376 forks source link

Add sqlanywhere to connect to sqlanywhere instances #917

Open leroy0211 opened 3 months ago

leroy0211 commented 3 months ago

Add sqlanywhere php extension (and driver) to connect to sqlanywhere servers. Comes with acceptance of a license agreement, so I'm not sure how this should be done with php-extension-installer.

The extension requires a client driver to be installed too. I'm not sure if php-extension-installer need to install it, because the client could be a different version.

We usually run the following with version sqlanywhere client version 17:

# multi staged build 
FROM ...   AS sqlanywhere
ENV        SQLANYWHERE_PHP="https://s3.amazonaws.com/sqlanywhere/drivers/php/sasql_php.zip" \
           SQL_ANYWHERE_CLIENT="http://d5d4ifzqzkhwt.cloudfront.net/sqla17client/sqla17_client_linux_x86x64.tar.gz"

RUN        apt update && apt install -yq zip
RUN        curl -s ${SQLANYWHERE_PHP} -o sasql_php.zip && unzip sasql_php.zip -d /tmp/sasql_php
RUN        curl -sL ${SQL_ANYWHERE_CLIENT} | tar xz -C /tmp
RUN        cd /tmp/sasql_php && phpize && ./configure && make
RUN        cd /tmp/client17011 && ./setup -install sqlany_client64 -silent -nogui -I_accept_the_license_agreement

# the app build
FROM       php

ENV        LD_LIBRARY_PATH="/opt/sqlanywhere17/lib64" \
           SQLANY17="/opt/sqlanywhere17"

COPY       --from=sqlanywhere    /opt /opt
COPY       --from=sqlanywhere    /tmp/sasql_php/modules/sqlanywhere.so /usr/local/lib/php/extensions/sqlanywhere.so

RUN        echo "extension=/usr/local/lib/php/extensions/sqlanywhere.so" > /usr/local/etc/php/conf.d/sqlanywhere.ini
mlocati commented 3 months ago

Do you know if they have plans to publish sqlanywhere to pecl.php.net? I see that there are https://pecl.php.net/package/sqlanywhere and https://pecl.php.net/package/PDO_SQLANYWHERE but they seems outdated/unmaintained...

(Maintaining support for installing packages published on pecl is much easier)