Jumat, 17 Maret 2023

PHPEXCELZIP-docker

 

1 / 2
Feb 2022

Hello,

Hope I’m in the right forum, I’m a docker newbie…

I’m using phpexcel in my site.

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

Thank you in advance for your help

  • CREATED

    Feb '22
  • LAST REPLY

    Feb '22
  • 1

    REPLY

  • 1.7k

    VIEWS

  • 2

    USERS

ZipArchive is the part of the official PHP images as of version 5.6. Since I don’t know anything about your image, I can’t say much, because the installation depends on the actual image.

Since your comment in your Dockerfile indicates that the image is based on the official image or at least similar to that, if the zip extension is missing, you should be able to install it the same way as mysql, except you probably don’t need to enable it. This is how I did it:

Although it was probably not necessary for me.

================

Funny thing, me to. I have been playing with Docker for the last several days after leaving it long ago.

This is what I did on Ubuntu 22

Dockerfile

FROM php:8.1-apache RUN docker-php-ext-install mysqli && docker-php-ext-enable mysqli && docker-php-ext-install pdo pdo_mysql && docker-php-ext-enable pdo pdo_mysql RUN apt-get update && apt-get upgrade -y RUN apt-get install -y \ libzip-dev \ zip \ && docker-php-ext-install zip

Result

And this is my docker-compose.yml

=======================

enable php.ini

extension=zip.so



Tidak ada komentar:

Posting Komentar