Skip to content

Can't add the PHPExcel lib top the Docker container and PHP Alpine base image #28

@teertz

Description

@teertz

Describe the bug
We are trying to use it in our Docker setup, however, we're encountering the issue:

2.293 checking for libxml2... not found
2.293 checking for xlCreateBookCA in -lxl... configure: error: excel module requires libxl >= 2.4.3

To Reproduce
Steps to reproduce the behavior:
Dockerfile:

FROM php:8.2-alpine AS base

ARG LIBXL_VERSION="4.2.0"

RUN apk add --update linux-headers
RUN apk add --no-cache g++ gcc libxml2 libxml2-dev $PHPIZE_DEPS

#LibXL
RUN cd /tmp \
&& wget http://www.libxl.com/download/libxl-lin-${LIBXL_VERSION}.tar.gz \
&& tar -zxv -f libxl-lin-${LIBXL_VERSION}.tar.gz \
&& cp /tmp/libxl-${LIBXL_VERSION}/lib64/libxl.so /usr/lib/libxl.so \
&& mkdir -p /usr/local/include/libxl_c/ \
&& cp /tmp/libxl-${LIBXL_VERSION}/include_c/* /usr/local/include/libxl_c/

# PHP Excel extension
RUN curl -fsSL 'https://github.com/doPhp/excel/archive/refs/heads/main.zip' -o /tmp/phpexcel.zip \
&& unzip -o /tmp/phpexcel.zip -d /tmp \
&& cd /tmp/excel-main \
&& phpize \
&& ./configure \
--with-excel=shared \
--with-libxl-incdir=/tmp/libxl-${LIBXL_VERSION}/include_c/ \
--with-libxl-libdir=/tmp/libxl-${LIBXL_VERSION}/lib64

Command we use to build it from a docker file is:
docker buildx build --file ./Dockerfile1 ./ --no-cache

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions