プログラム初心者です。
Mac OS Catalina(10.15.3)を使用してます。
本物の初心者なので、間違っている事を書いているかもしれません。
もしありましたらご指摘いただけたらと思います。
とにかく動かすために環境構築しないと、ってことで勉強中のPHPとLaravelのインストールを行うとした矢先、早速エラーが。
$ composer global require laravel/installer
これをやったら、
Your requirements could not be resolved to an installable set of packages.
Problem 1
- laravel/installer v3.0.1 requires ext-zip * -> the requested PHP extension zip is missing from your system.
- laravel/installer v3.0.0 requires ext-zip * -> the requested PHP extension zip is missing from your system.
- Installation request for laravel/installer ^3.0 -> satisfiable by laravel/installer[v3.0.0, v3.0.1].
Installation failed, deleting ./composer.json.
なんかよく分からないが、必要なものが足りていないっぽい。
再度PHPバージョンを確認。
$ php -v
$ brew search php
表示されるPHPのバージョンを確認した後に、再度インストール。
(私がしたときは7.3でした)
$ brew install php@7.3
終了するとこんな表示が出てくるので、言われた通りにパスを通す。
If you need to have php@7.3 first in your PATH run:
echo 'export PATH="/usr/local/opt/php@7.3/bin:$PATH"' >> ~/.bash_profile
echo 'export PATH="/usr/local/opt/php@7.3/sbin:$PATH"' >> ~/.bash_profile
その後、もう一度Laravelインストールできるか試す。
$ composer global require Laravel/installer
そうしたらなんとか完了しました。
ただ下の方に気になる文章が出てきたので、メモ代わりに残しておきます。
symfony/service-contracts suggests installing symfony/service-implementation
symfony/console suggests installing symfony/event-dispatcher
symfony/console suggests installing symfony/lock
symfony/console suggests installing psr/log (For using the console logger)
guzzlehttp/psr7 suggests installing zendframework/zend-httphandlerrunner (Emit PSR-7 responses)
guzzlehttp/guzzle suggests installing psr/log (Required for using the Log middleware)
Writing lock file
Generating autoload files
1 package you are using is looking for funding.
Use the composer fund command to find out more!
Laravelのコマンドが認識されることを確認。
試しにデスクトップに新規でプロジェクト作成。
$ cd desktop
$ Laravel new laravelプロジェクト名
ce laravelプロジェクト名
php artisan serve
この後ブラウザで
http://localhost:8000/
にアクセスして、Laravelトップページが表示されました。
やっと終了。
ありがとうございました。