From 2b6765d75027d64d6c2b260c376ddc478588cd14 Mon Sep 17 00:00:00 2001 From: "Eloy Lafuente (stronk7)" Date: Fri, 19 Jan 2018 01:23:41 +0100 Subject: [PATCH] Preliminar support for php72 With sqlsrv latest 5.2-RC1 drivers and MSODBC 17 preview it seems that it's possible to make the extension to work under Debian 9. it requires to install MSODBC 13, uninstall it and then install MSODBC 17, but seems to be working ok. oci also requires some little changes and, finally, what I've been unable to fix/make work is solr. it seems that still is not ready, so I've disabled it for now. This will help fixing #16. --- Dockerfile | 3 ++- README.md | 1 + root/tmp/setup/oci8-extension.sh | 3 +++ root/tmp/setup/php-extensions.sh | 23 ++++++++------------- root/tmp/setup/sqlsrv-extension.sh | 33 ++++++++++++++++++++++++++++++ tests/fixtures/test.php | 2 +- 6 files changed, 49 insertions(+), 16 deletions(-) create mode 100755 root/tmp/setup/sqlsrv-extension.sh diff --git a/Dockerfile b/Dockerfile index 785763b..318f4e9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,10 @@ -FROM php:7.1-apache +FROM php:7.2-apache ADD root/ / # Fix the original permissions of /tmp, the PHP default upload tmp dir. RUN chmod 777 /tmp && chmod +t /tmp # Setup the required extensions. +ARG DEBIAN_FRONTEND=noninteractive RUN /tmp/setup/php-extensions.sh RUN /tmp/setup/oci8-extension.sh diff --git a/README.md b/README.md index 9e5c142..e1a87c4 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ A Moodle PHP environment configured for Moodle development based on [Official PH | PHP Version | Tag | Status | |--------------|-----|--------| +| PHP 7.2 | 7.2 | [![Build Status](https://travis-ci.org/moodlehq/moodle-php-apache.svg?branch=php72)](https://travis-ci.org/moodlehq/moodle-php-apache)| | PHP 7.1 | 7.1 | [![Build Status](https://travis-ci.org/moodlehq/moodle-php-apache.svg?branch=php71)](https://travis-ci.org/moodlehq/moodle-php-apache)| | PHP 7.0 | 7.0 | [![Build Status](https://travis-ci.org/moodlehq/moodle-php-apache.svg?branch=php70)](https://travis-ci.org/moodlehq/moodle-php-apache)| |PHP 5.6 | 5.6 | [![Build Status](https://travis-ci.org/moodlehq/moodle-php-apache.svg?branch=php56)](https://travis-ci.org/moodlehq/moodle-php-apache)| diff --git a/root/tmp/setup/oci8-extension.sh b/root/tmp/setup/oci8-extension.sh index b6ced11..d5a9567 100755 --- a/root/tmp/setup/oci8-extension.sh +++ b/root/tmp/setup/oci8-extension.sh @@ -21,5 +21,8 @@ ln -s /usr/local/instantclient_12_1 /usr/local/instantclient ln -s /usr/local/instantclient/libclntsh.so.12.1 /usr/local/instantclient/libclntsh.so ln -s /usr/local/instantclient/sqlplus /usr/bin/sqlplus +echo 'export LD_LIBRARY_PATH="/usr/local/instantclient"' >> /root/.bashrc +echo 'umask 002' >> /root/.bashrc + echo 'instantclient,/usr/local/instantclient' | pecl install oci8 && docker-php-ext-enable oci8 echo 'oci8.statement_cache_size = 0' >> /usr/local/etc/php/conf.d/docker-php-ext-oci8.ini diff --git a/root/tmp/setup/php-extensions.sh b/root/tmp/setup/php-extensions.sh index e479f9a..6355ece 100755 --- a/root/tmp/setup/php-extensions.sh +++ b/root/tmp/setup/php-extensions.sh @@ -2,13 +2,13 @@ set -e -echo "Installing apt depdencies" +echo "Installing apt dependencies" -BUILD_PACKAGES="gettext libcurl4-openssl-dev libpq-dev libmysqlclient-dev libldap2-dev libxslt-dev \ +BUILD_PACKAGES="gettext libcurl4-openssl-dev libpq-dev default-libmysqlclient-dev libldap2-dev libxslt-dev \ libxml2-dev libicu-dev libfreetype6-dev libjpeg62-turbo-dev libmemcached-dev \ - zlib1g-dev libpng12-dev unixodbc-dev" + zlib1g-dev libpng-dev unixodbc-dev gnupg2" -LIBS="locales libaio1 libcurl3 libgss3 libicu52 libmysqlclient18 libpq5 libmemcached11 libmemcachedutil2 libldap-2.4-2 libxml2 libxslt1.1 unixodbc libmcrypt-dev" +LIBS="locales libaio1 libcurl3 libgss3 libicu57 libpq5 libmemcached11 libmemcachedutil2 libldap-2.4-2 libxml2 libxslt1.1 unixodbc libmcrypt-dev" apt-get update apt-get install -y --no-install-recommends $BUILD_PACKAGES $LIBS unzip ghostscript locales apt-transport-https @@ -34,19 +34,14 @@ docker-php-ext-install -j$(nproc) gd docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ docker-php-ext-install -j$(nproc) ldap -pecl install solr memcached redis apcu igbinary -docker-php-ext-enable solr memcached redis apcu igbinary +pecl install memcached redis apcu igbinary +docker-php-ext-enable memcached redis apcu igbinary echo 'apc.enable_cli = On' >> /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini -# Install Microsoft depdencises for sqlsrv -curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - -curl https://packages.microsoft.com/config/debian/8/prod.list -o /etc/apt/sources.list.d/mssql-release.list -apt-get update -ACCEPT_EULA=Y apt-get install -y msodbcsql - -pecl install sqlsrv-4.3.0 -docker-php-ext-enable sqlsrv +# Go for sqlsrv extension now (kept apart for clarity, still need to be run here +# before some build packages are deleted. +/tmp/setup/sqlsrv-extension.sh # Keep our image size down.. pecl clear-cache diff --git a/root/tmp/setup/sqlsrv-extension.sh b/root/tmp/setup/sqlsrv-extension.sh new file mode 100755 index 0000000..13fafe0 --- /dev/null +++ b/root/tmp/setup/sqlsrv-extension.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash + +set -e + +# Install Microsoft dependencies for sqlsrv +# Debian 9 requires ODBC driver 17, still not package available in repos, so followed this +# https://github.com/Microsoft/msphpsql/wiki/Install-and-configuration#user-content-odbc-17-linux-installation +echo "Downloading sqlsrv files" +curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - +curl https://packages.microsoft.com/config/debian/8/prod.list -o /etc/apt/sources.list.d/mssql-release.list +apt-get update + +echo "Install msodbcsql" +ACCEPT_EULA=Y apt-get install -y msodbcsql + +# now remove ODBC driver 13.1, then download and install 17 from Github +apt-get purge -y msodbcsql + +curl https://raw.githubusercontent.com/Microsoft/msphpsql/dev/ODBC%2017%20binaries%20preview/Debian%209/msodbcsql_17.0.0.5-1_amd64.deb \ + -o /tmp/msodbcsql_17.0.0.5-1_amd64.deb +curl https://raw.githubusercontent.com/Microsoft/msphpsql/dev/ODBC%2017%20binaries%20preview/Debian%209/mssql-tools_17.0.0.5-1_amd64.deb \ + -o /tmp/mssql-tools_17.0.0.5-1_amd64.deb + +ACCEPT_EULA=Y dpkg -i /tmp/msodbcsql_17.0.0.5-1_amd64.deb +ACCEPT_EULA=Y dpkg -i /tmp/mssql-tools_17.0.0.5-1_amd64.deb + +rm /tmp/msodbcsql_17.0.0.5-1_amd64.deb +rm /tmp/mssql-tools_17.0.0.5-1_amd64.deb + +ln -fsv /opt/mssql-tools/bin/* /usr/bin + +pecl install sqlsrv-5.2.0RC1 +docker-php-ext-enable sqlsrv diff --git a/tests/fixtures/test.php b/tests/fixtures/test.php index dbff555..949100e 100644 --- a/tests/fixtures/test.php +++ b/tests/fixtures/test.php @@ -11,7 +11,7 @@ 'oci8', 'pgsql', 'redis', - 'solr', +# Disabled because it's not available for php72 yet 'solr', 'soap', 'sqlsrv', 'xsl',