Reputation: 83
I am having an issue installing PHPOffice/PHPSpreadsheet on my production server using composer. When I run composer install
or composer update
I get the following
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Root composer.json requires phpoffice/phpspreadsheet ^1.19.0 -> satisfiable by phpoffice/phpspreadsheet[1.19.0].
- phpoffice/phpspreadsheet 1.19.0 requires ext-zip * -> it is missing from your system. Install or enable PHP's zip extension.
To enable extensions, verify that they are enabled in your .ini files:
- /etc/php.ini
- /etc/php.d/20-bcmath.ini
- /etc/php.d/20-bz2.ini
- /etc/php.d/20-calendar.ini
- /etc/php.d/20-ctype.ini
- /etc/php.d/20-curl.ini
- /etc/php.d/20-dom.ini
- /etc/php.d/20-exif.ini
- /etc/php.d/20-fileinfo.ini
- /etc/php.d/20-ftp.ini
- /etc/php.d/20-gd.ini
- /etc/php.d/20-gettext.ini
- /etc/php.d/20-iconv.ini
- /etc/php.d/20-mbstring.ini
- /etc/php.d/20-mysqlnd.ini
- /etc/php.d/20-pdo.ini
- /etc/php.d/20-phar.ini
- /etc/php.d/20-posix.ini
- /etc/php.d/20-shmop.ini
- /etc/php.d/20-simplexml.ini
- /etc/php.d/20-sockets.ini
- /etc/php.d/20-sodium.ini
- /etc/php.d/20-sqlite3.ini
- /etc/php.d/20-sysvmsg.ini
- /etc/php.d/20-sysvsem.ini
- /etc/php.d/20-sysvshm.ini
- /etc/php.d/20-tokenizer.ini
- /etc/php.d/20-xml.ini
- /etc/php.d/20-xmlwriter.ini
- /etc/php.d/20-xsl.ini
- /etc/php.d/30-mysqli.ini
- /etc/php.d/30-pdo_mysql.ini
- /etc/php.d/30-pdo_sqlite.ini
- /etc/php.d/30-xmlreader.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
bash-4.2$ composer install --with-all-dependencies
[Symfony\Component\Console\Exception\RuntimeException]
The "--with-all-dependencies" option does not exist.
install [--prefer-source] [--prefer-dist] [--prefer-install PREFER-INSTALL] [--dry-run] [--dev] [--no-suggest] [--no-dev] [--no-autoloader] [--no-scripts] [--no-progress] [--no-install] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--apcu-autoloader-prefix APCU-AUTOLOADER-PREFIX] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-reqs] [--] [<packages>]...
I am running PHP 8.0, and when I installed it I installed php-zip
When I run php -m
I get the following list
[PHP Modules]
bcmath
bz2
calendar
Core
ctype
curl
date
dom
exif
fileinfo
filter
ftp
gd
gettext
hash
iconv
json
libxml
mbstring
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
readline
Reflection
session
shmop
SimpleXML
sockets
sodium
SPL
sqlite3
standard
sysvmsg
sysvsem
sysvshm
tokenizer
xml
xmlreader
xmlwriter
xsl
zlib
[Zend Modules]
I have tried everything I could possibly think of to enable the zip extension. I've even tried installing it again using sudo yum install php-zip
and then attempting to enable it.
I installed my PHP stack using the following:
sudo yum -y install php php-{cli,fpm,mysqlnd,zip,devel,gd,mbstring,curl,xml,pear,bcmath,json}
after PHP was installed, I ran php -m
and saw that the zip module was not loaded. I then ran sudo yum -y php-zip
viewed the loaded modules again, and it still was not there. I then modified the php.ini file and added extension=php
. After I ran php -v
and I received this message
PHP Warning: PHP Startup: Unable to load dynamic library 'zip' (tried: /usr/lib64/php/modules/zip (/usr/lib64/php/modules/zip: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/zip.so (/usr/lib64/php/modules/zip.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP 8.0.12 (cli) (built: Oct 19 2021 10:34:32) ( NTS gcc x86_64 )
Copyright (c) The PHP Group
Zend Engine v4.0.12, Copyright (c) Zend Technologies
This is the full list of commands I used to install PHP 8. I followed the directions from the this website: https://www.tecmint.com/install-php-8-on-centos/
here are the commands I used
sudo yum install -y https://rpms.remirepo.net/enterprise/remi-release-7.rpm
sudo yum -y install yum-utils
sudo yum-config-manager --disable 'remi-php*'
sudo yum-config-manager --enable remi-php80
sudo yum -y install php php-{cli,fpm,mysqlnd,zip,devel,gd,mbstring,curl,xml,pear,bcmath,json}
Does anybody have any thoughts or ideas?
Upvotes: 5
Views: 18200
Reputation: 83
I was finally able to get the zip extension to load by installing the pecl zip module
sudo yum install php-pecl-zip
Once it installed and I reloaded apache running php -m
showed
bcmath
bz2
calendar
Core
ctype
curl
date
dom
exif
fileinfo
filter
ftp
gd
gettext
hash
iconv
json
libxml
mbstring
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
readline
Reflection
session
shmop
SimpleXML
sockets
sodium
SPL
sqlite3
standard
sysvmsg
sysvsem
sysvshm
tokenizer
xml
xmlreader
xmlwriter
xsl
zip
zlib
[Zend Modules]
Upvotes: 2