[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"

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.