概要
composer global require laravel/installer
このURL:https://laravel.com/docs/5.8からのコピペでインストールしようとしたが、エラーで弾かれた。
環境
- CentOS7
- php7.2
エラー内容
$ composer global require laravel/installer
Changed current directory to /home/ec2-user/.config/composer
Using version ^2.1 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
- Installation request for laravel/installer ^2.1 -> satisfiable by laravel/installer[v2.1.0].
- laravel/installer v2.1.0 requires ext-zip * -> the requested PHP extension zip is missing from your system.
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.
原因
- phpのZIPが利用出来ないためのエラーだった
-
yum install php-zip
が出来なかった
解決方法
試しに以下のコードを打ったところ[php72-php-pecl-zip]がインストールされた
yum install php72-php-zip
このあとに、composer global require laravel/installer
を実行したら普通にコマンドが通りました。
★php-zip という古い記事にかかれたものは、入りませんでした。