Search code examples
phphomebrewpecl

Wrong version of the zip extension displayed in php.ini vs pecl install


when I'm issuing the composer update command, I get an error :

[18:54] thomas@Thomass-MBP:~/Dropbox/eclipse-workspace/crf2/RedCrossQuest/server$ composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - The requested PHP extension ext-zip ^7.2 has the wrong version (1.15.4) installed. Install or enable PHP's zip extension.

1.15.4 is indeed the version reported when doing a phpinfo();

To fix that, I've tried to update zip by using PECL. The first time I ran the command, I saw some standard compilation messages (but I think there was some warning)

I've restarted apache and it's still showing the 1.15.4 version. And composer is also still complaining about the 1.15.4 version.

In addition, I started to have warning about the zip extension included twice. PHP Warning: Module 'zip' already loaded in Unknown on line 0

I had to remove the extension from the php.ini, but I don't understand from where it's now included.

When I try to install again, I get this :

[18:43] thomas@Thomass-MBP:~$ sudo pecl install zip
Password:
pecl/zip is already installed and is the same as the released version 1.15.5
install failed

I've uninstalled all extension and reinstalled them, and now :

sudo pecl   install grpc protobuf xdebug zip
sudo pecl uninstall grpc protobuf xdebug zip
[19:30] thomas@Thomass-MBP:/usr/local/etc/php/7.2$ php
/usr/local/Cellar/[email protected]/7.2.22_1/pecl/20170718/protobuf.so doesn't appear to be a valid Zend extension
/usr/local/Cellar/[email protected]/7.2.22_1/pecl/20170718/grpc.so doesn't appear to be a valid Zend extension
PHP Warning:  Module 'zip' already loaded in Unknown on line 0

Warning: Module 'zip' already loaded in Unknown on line 0
PHP Warning:  Xdebug MUST be loaded as a Zend extension in Unknown on line 0

Warning: Xdebug MUST be loaded as a Zend extension in Unknown on line 0
PHP Warning:  Module 'xdebug' already loaded in Unknown on line 0

Warning: Module 'xdebug' already loaded in Unknown on line 0

I think brew just blew up my php installation... :(

Any idea how to clean up this mess?


Solution

  • It seems that the brew formula comes with zip extension built-in in version 1.15.4, as I've just reinstalled httpd/php and zip is already present.

    it's unlikely that PECL can override this.

    There's either an issue in brew or in composer. My guess is that it's a composer issue : https://github.com/composer/composer/issues/8342

    A work around provided by xabbuh on the github ticket is to put a wild card instead of the version.

    so :

    "ext-zip" : "*"
    

    instead of

    "ext-zip" : "^7.2"
    

    about the

    /usr/local/Cellar/[email protected]/7.2.22_1/pecl/20170718/protobuf.so doesn't appear to be a valid Zend extension
    /usr/local/Cellar/[email protected]/7.2.22_1/pecl/20170718/grpc.so doesn't appear to be a valid Zend extension
    

    It seems that pecl incorrectly add the extension as zend_extension (while it also add them as "extension" and sometime two time for one extension)...