ZipArchive is missing, how include it in DockerFile?

Viewed 165

I have this error :

Fatal error: Class 'ZipArchive' not found in /var/www/html/excel/phpExcel/PHPExcel/Writer/Excel2007.php on line 227

because I have to move my site from one server to a new one (with DockerFile...)

I'm using PHPExcel, and like we can see in the error, ZipArchive is missing.

Do you know how can I include it below in my DockerFile please ?

FROM registry.xe.ulb.be:5000/global-okd/php/5.6.40-apache-cas:latest

LABEL maintainer="JBM<jJBM@nothing.be> && Developper"

USER root

# Add here your PHP ext
# Ex : RUN docker-php-ext-install mysql && docker-php-ext-enable mysql
1 Answers

The following extensions are required prior to using PHPExcel:

  • zip
  • xml
  • gd

Check if these extensions installed:

  • Using command line
php -m
  • Using php code:
<?php
 phpinfo();
?>

If they are not installed, you just need to install the required extensions. Make sure to have libzip-dev package at runtime, since zip extension requires it.

# Install required dependency
RUN apt-get update && apt-get install -y \
    zip \
    libxml2-dev \
    libzip-dev

# Configure and install gd extension
RUN apt-get update && apt-get install -y \
    libfreetype6-dev \
    libjpeg62-turbo-dev \
    libpng-dev \
  && docker-php-ext-configure gd --with-freetype --with-jpeg \
  && docker-php-ext-install -j$(nproc) gd

# Install zip and zml
RUN docker-php-ext-install zip xml
Related