Skip to content

Commit aaf7d05

Browse files
committed
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, have been updated to 12.2 libraries and is using proper ENV for both interactive and non-interactive sessions. 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 moodlehq#16.
1 parent c0df519 commit aaf7d05

File tree

6 files changed

+67
-31
lines changed

6 files changed

+67
-31
lines changed

Dockerfile

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
FROM php:7.1-apache
1+
FROM php:7.2-apache
22

33
ADD root/ /
44
# Fix the original permissions of /tmp, the PHP default upload tmp dir.
55
RUN chmod 777 /tmp && chmod +t /tmp
66
# Setup the required extensions.
7+
ARG DEBIAN_FRONTEND=noninteractive
78
RUN /tmp/setup/php-extensions.sh
89
RUN /tmp/setup/oci8-extension.sh
10+
ENV LD_LIBRARY_PATH /usr/local/instantclient
911

1012
RUN mkdir /var/www/moodledata && chown www-data /var/www/moodledata && \
1113
mkdir /var/www/phpunitdata && chown www-data /var/www/phpunitdata && \

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ A Moodle PHP environment configured for Moodle development based on [Official PH
66

77
| PHP Version | Tag | Status |
88
|--------------|-----|--------|
9+
| 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)|
910
| 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)|
1011
| 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)|
1112
|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)|

root/tmp/setup/oci8-extension.sh

+20-15
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,28 @@
33
set -e
44

55
echo "Downloading oracle files"
6-
curl https://raw.githubusercontent.com/AminMkh/docker-php7-oci8-apache/b7c740638776552f00178a5d12905cefb50c7848/oracle/instantclient-basic-linux.x64-12.1.0.2.0.zip\
7-
-o /tmp/instantclient-basic-linux.x64-12.1.0.2.0.zip
8-
curl https://raw.githubusercontent.com/AminMkh/docker-php7-oci8-apache/b7c740638776552f00178a5d12905cefb50c7848/oracle/instantclient-sdk-linux.x64-12.1.0.2.0.zip\
9-
-o /tmp/instantclient-sdk-linux.x64-12.1.0.2.0.zip
10-
curl https://raw.githubusercontent.com/AminMkh/docker-php7-oci8-apache/b7c740638776552f00178a5d12905cefb50c7848/oracle/instantclient-sqlplus-linux.x64-12.1.0.2.0.zip\
11-
-o /tmp/instantclient-sqlplus-linux.x64-12.1.0.2.0.zip
12-
13-
unzip /tmp/instantclient-basic-linux.x64-12.1.0.2.0.zip -d /usr/local/
14-
rm /tmp/instantclient-basic-linux.x64-12.1.0.2.0.zip
15-
unzip /tmp/instantclient-sdk-linux.x64-12.1.0.2.0.zip -d /usr/local/
16-
rm /tmp/instantclient-sdk-linux.x64-12.1.0.2.0.zip
17-
unzip /tmp/instantclient-sqlplus-linux.x64-12.1.0.2.0.zip -d /usr/local/
18-
rm /tmp/instantclient-sqlplus-linux.x64-12.1.0.2.0.zip
19-
20-
ln -s /usr/local/instantclient_12_1 /usr/local/instantclient
6+
7+
curl https://raw.githubusercontent.com/bumpx/oracle-instantclient/6aa46afa7a/instantclient-basic-linux.x64-12.2.0.1.0.zip \
8+
-o /tmp/instantclient-basic-linux.x64-12.2.0.1.0.zip
9+
unzip /tmp/instantclient-basic-linux.x64-12.2.0.1.0.zip -d /usr/local/
10+
rm /tmp/instantclient-basic-linux.x64-12.2.0.1.0.zip
11+
12+
curl https://raw.githubusercontent.com/bumpx/oracle-instantclient/6aa46afa7a/instantclient-sdk-linux.x64-12.2.0.1.0.zip \
13+
-o /tmp/instantclient-sdk-linux.x64-12.2.0.1.0.zip
14+
unzip /tmp/instantclient-sdk-linux.x64-12.2.0.1.0.zip -d /usr/local/
15+
rm /tmp/instantclient-sdk-linux.x64-12.2.0.1.0.zip
16+
17+
curl https://raw.githubusercontent.com/bumpx/oracle-instantclient/6aa46afa7a/instantclient-sqlplus-linux.x64-12.2.0.1.0.zip \
18+
-o /tmp/instantclient-sqlplus-linux.x64-12.2.0.1.0.zip
19+
unzip /tmp/instantclient-sqlplus-linux.x64-12.2.0.1.0.zip -d /usr/local/
20+
rm /tmp/instantclient-sqlplus-linux.x64-12.2.0.1.0.zip
21+
22+
ln -s /usr/local/instantclient_12_2 /usr/local/instantclient
2123
ln -s /usr/local/instantclient/libclntsh.so.12.1 /usr/local/instantclient/libclntsh.so
2224
ln -s /usr/local/instantclient/sqlplus /usr/bin/sqlplus
2325

26+
#echo 'export LD_LIBRARY_PATH="/usr/local/instantclient"' >> /root/.bashrc
27+
#echo 'umask 002' >> /root/.bashrc
28+
2429
echo 'instantclient,/usr/local/instantclient' | pecl install oci8 && docker-php-ext-enable oci8
2530
echo 'oci8.statement_cache_size = 0' >> /usr/local/etc/php/conf.d/docker-php-ext-oci8.ini

root/tmp/setup/php-extensions.sh

+9-14
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
set -e
44

5-
echo "Installing apt depdencies"
5+
echo "Installing apt dependencies"
66

7-
BUILD_PACKAGES="gettext libcurl4-openssl-dev libpq-dev libmysqlclient-dev libldap2-dev libxslt-dev \
7+
BUILD_PACKAGES="gettext libcurl4-openssl-dev libpq-dev default-libmysqlclient-dev libldap2-dev libxslt-dev \
88
libxml2-dev libicu-dev libfreetype6-dev libjpeg62-turbo-dev libmemcached-dev \
9-
zlib1g-dev libpng12-dev unixodbc-dev"
9+
zlib1g-dev libpng-dev unixodbc-dev gnupg2"
1010

11-
LIBS="locales libaio1 libcurl3 libgss3 libicu52 libmysqlclient18 libpq5 libmemcached11 libmemcachedutil2 libldap-2.4-2 libxml2 libxslt1.1 unixodbc libmcrypt-dev"
11+
LIBS="locales libaio1 libcurl3 libgss3 libicu57 libpq5 libmemcached11 libmemcachedutil2 libldap-2.4-2 libxml2 libxslt1.1 unixodbc libmcrypt-dev"
1212

1313
apt-get update
1414
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
3434
docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/
3535
docker-php-ext-install -j$(nproc) ldap
3636

37-
pecl install solr memcached redis apcu igbinary
38-
docker-php-ext-enable solr memcached redis apcu igbinary
37+
pecl install memcached redis apcu igbinary
38+
docker-php-ext-enable memcached redis apcu igbinary
3939

4040
echo 'apc.enable_cli = On' >> /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini
4141

42-
# Install Microsoft depdencises for sqlsrv
43-
curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
44-
curl https://packages.microsoft.com/config/debian/8/prod.list -o /etc/apt/sources.list.d/mssql-release.list
45-
apt-get update
46-
ACCEPT_EULA=Y apt-get install -y msodbcsql
47-
48-
pecl install sqlsrv-4.3.0
49-
docker-php-ext-enable sqlsrv
42+
# Go for sqlsrv extension now (kept apart for clarity, still need to be run here
43+
# before some build packages are deleted.
44+
/tmp/setup/sqlsrv-extension.sh
5045

5146
# Keep our image size down..
5247
pecl clear-cache

root/tmp/setup/sqlsrv-extension.sh

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
# Install Microsoft dependencies for sqlsrv
6+
# Debian 9 requires ODBC driver 17, still not package available in repos, so followed this
7+
# https://github.com/Microsoft/msphpsql/wiki/Install-and-configuration#user-content-odbc-17-linux-installation
8+
echo "Downloading sqlsrv files"
9+
curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
10+
curl https://packages.microsoft.com/config/debian/8/prod.list -o /etc/apt/sources.list.d/mssql-release.list
11+
apt-get update
12+
13+
echo "Install msodbcsql"
14+
ACCEPT_EULA=Y apt-get install -y msodbcsql
15+
16+
# now remove ODBC driver 13.1, then download and install 17 from Github
17+
apt-get purge -y msodbcsql
18+
19+
curl https://raw.githubusercontent.com/Microsoft/msphpsql/dev/ODBC%2017%20binaries%20preview/Debian%209/msodbcsql_17.0.0.5-1_amd64.deb \
20+
-o /tmp/msodbcsql_17.0.0.5-1_amd64.deb
21+
curl https://raw.githubusercontent.com/Microsoft/msphpsql/dev/ODBC%2017%20binaries%20preview/Debian%209/mssql-tools_17.0.0.5-1_amd64.deb \
22+
-o /tmp/mssql-tools_17.0.0.5-1_amd64.deb
23+
24+
ACCEPT_EULA=Y dpkg -i /tmp/msodbcsql_17.0.0.5-1_amd64.deb
25+
ACCEPT_EULA=Y dpkg -i /tmp/mssql-tools_17.0.0.5-1_amd64.deb
26+
27+
rm /tmp/msodbcsql_17.0.0.5-1_amd64.deb
28+
rm /tmp/mssql-tools_17.0.0.5-1_amd64.deb
29+
30+
ln -fsv /opt/mssql-tools/bin/* /usr/bin
31+
32+
pecl install sqlsrv-5.2.0RC1
33+
docker-php-ext-enable sqlsrv

tests/fixtures/test.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
'oci8',
1212
'pgsql',
1313
'redis',
14-
'solr',
14+
# Disabled because it's not available for php72 yet 'solr',
1515
'soap',
1616
'sqlsrv',
1717
'xsl',

0 commit comments

Comments
 (0)