ZipArchive not found when using php-worker form laradock

501 Views Asked by At

Basically I've this package which internally uses ZipArchive

I've set up the flag PHP_FPM_INSTALL_ZIP_ARCHIVE=true for my php-fpm container

The package works as expected when I launch php artisan log:archive command inside my workspace container but if I try to setup Horizon on php-worker something awful happens, basically as soon as I start php-worker docker-compose up -d php-worker with the following configuration for supervisor:

[program:laravel-horizon]
process_name=%(program_name)s
command=php /var/www/artisan horizon
autostart=true
autorestart=true
user=root
redirect_stderr=true
stdout_logfile=/var/www/storage/logs/horizon.log


[program:laravel-queue-work]
process_name=%(program_name)s_%(process_num)02da
command=php /var/www/artisan queue:work --sleep=3 --tries=3 --daemon
autostart=true
autorestart=true
user=root
numprocs=8
redirect_stderr=true
stdout_logfile=/var/www/storage/logs/queue-work.log

Both queue-work.log and horizon.log are filled with a Class ZipArchive not found in ArchiveCommand.php

Of course removing the package from the dependencies solves the problem but it should not be a solution since ZipArchive is installed and the package works as expected inside workspace

What am I missing?


Expected behavior:

Container php-worker should start without prompting for the exception Class ZipArchive not found in ...


Reproduce:

  • Fresh install of laravel
  • Add "ludo237/laravel-logs-manager": "^1.0", as dependency
  • Build workspace and php-fpm with PHP_FPM_INSTALL_ZIP_ARCHIVE=true
  • Test the command excepted behavior in workspace
  • Create a php-worker container with the supervisor configuration above
  • Test the unexpected behavior inside the logs

Related issue on Github

1

There are 1 best solutions below

0
On

PHP-FPM container and PHP-WORKER container is not the same you need to install the package to PHP-WORKER. ( php-worker is where supervisor is running )