[Docker] PHP LibXL integration on Docker Image (Ubuntu 18.04)

Compile LibXL extension for PHP 7.2 @ Ubuntu 18.04, using Docker multi-stage build


FROM ubuntu:18.04 as build

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && apt-get install -y php7.2-dev libxml2-dev git wget

RUN wget http://www.libxl.com/download/libxl-lin-3.8.5.tar.gz && \
tar -zxv -f libxl-lin-3.8.5.tar.gz && \
cd libxl- && \
cp lib64/libxl.so /usr/lib/libxl.so && \
mkdir -p /usr/include/libxl_c/ && \
cp include_c/* /usr/include/libxl_c/

RUN git clone https://github.com/Jan-E/php_excel.git -b php7-issue241 && \
cd php_excel && \
phpize && \
./configure --with-php-config=/usr/bin/php-config --with-libxl-incdir=/usr/include/libxl_c/ --with-libxml-dir=/usr/include/libxml2/ --with-excel && \

FROM ubuntu:18.04

# Install your PHP stack 

# Install LibXL
COPY --from=build /php_excel/modules/excel.so /usr/lib/php/20170718/

COPY --from=build /libxl- /usr/lib/libxl.so

COPY ./docker/excel.ini /etc/php/7.2/mods-available/

RUN phpenmod excel

# Other stuff


; priority=30

excel.license_name="Tiger Fok"

LibXL for PHP5/PHP7 on Ubuntu 14.04/16.04/18.04 Server

This is for iliaal’s php_excel extension – https://github.com/iliaal/php_excel

I found that the installation procedure is a bit different from the official installation method
(There are no ./buildconf file)

Just a quick note for future deployment

Continue reading “LibXL for PHP5/PHP7 on Ubuntu 14.04/16.04/18.04 Server”