laravel
centos7
PHP7.2
php-zip

CentOS7にPHP7.2とphp-prcl-zipを入れてもzipが有効にならない件

背景

CentOS7にPHP7.2を入れてLaravelをインストールしようとしていた。
で、composer global require "laravel/installer" したところで以下のようなエラー。

$ composer global require "laravel/installer"

Changed current directory to /home/webuser/.config/composer                                                                          
Using version ^2.0 for laravel/installer
./composer.json has been created
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
    - laravel/installer v2.0.1 requires ext-zip * -> the requested PHP extension zip is missing from your system.
    - laravel/installer v2.0.0 requires ext-zip * -> the requested PHP extension zip is missing from your system.
    - Installation request for laravel/installer ^2.0 -> satisfiable by laravel/installer[v2.0.0, v2.0.1].

  To enable extensions, verify that they are enabled in your .ini files:
    - /etc/opt/remi/php72/php.ini
    - /etc/opt/remi/php72/php.d/20-bz2.ini
    - /etc/opt/remi/php72/php.d/20-calendar.ini
    - /etc/opt/remi/php72/php.d/20-ctype.ini
    - /etc/opt/remi/php72/php.d/20-curl.ini
    - /etc/opt/remi/php72/php.d/20-exif.ini
    - /etc/opt/remi/php72/php.d/20-fileinfo.ini
    - /etc/opt/remi/php72/php.d/20-ftp.ini
    - /etc/opt/remi/php72/php.d/20-gettext.ini
    - /etc/opt/remi/php72/php.d/20-iconv.ini
    - /etc/opt/remi/php72/php.d/20-json.ini
    - /etc/opt/remi/php72/php.d/20-phar.ini
    - /etc/opt/remi/php72/php.d/20-sockets.ini
    - /etc/opt/remi/php72/php.d/20-tokenizer.ini
  You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

Installation failed, deleting ./composer.json.

PHP7.2とphp-zipはremiレポジトリからインストール済。

やったこと

php.dにzipの表記がないからかな?と、とりあえず設定を入れてみる。

$ sudo echo "extension=zip.so" > /etc/opt/remi/php72/php.d/20-zip.ini
$ php --ri zip
PHP Warning:  PHP Startup: Unable to load dynamic library 'zip.so' (tried: /opt/remi/php72/root/usr/lib64/php/modules/zip.so (/opt/remi/php72/root/usr/lib64/php/modules/zip.so: cannot open shared object file: No such file or directory), /opt/remi/php72/root/usr/lib64/php/modules/zip.so.so (/opt/remi/php72/root/usr/lib64/php/modules/zip.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
Extension 'zip' not present.

やっぱあかん。zip.soどこにあるんよ。

$ sudo find / -name zip.so -print
/usr/lib64/php/modules/zip.so
/usr/lib64/php-zts/modules/zip.so

なんでremiレポジトリから入れてるのに普通っぽいところに入ってるの・・・?

とりあえずリンクとか張ってみてもう一回見てみる。

$ sudo ln -s /usr/lib64/php/modules/zip.so /opt/remi/php72/root/usr/lib64/php/modules/zip.so
$ php --ri zip
zip

Zip => enabled
Zip version => 1.15.2
Libzip headers version => 1.3.2
Libzip library version => 1.5.1

いけた、、のか?バージョン自体はyumでインストールしたときのと同じっぽいけど・・・。

なんかしっくりこない・・・。