#実現したいこと
OSXでLaravelの開発環境を整えたい。
MAMP内のPHPを使用したい。
#エラーまでの過程
#####homebrewをインストール
bash
1/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
#####brew doctorにて確認
bash
1$Brew doctor 2 3Please note that these warnings are just used to help the Homebrew maintainers 4with debugging if you file an issue. If everything you use Homebrew for is 5working fine: please don't worry or file an issue; just ignore this. Thanks! 6 7Warning: Broken symlinks were found. Remove them with `brew cleanup`: 8 /usr/local/lib/libprotobuf-lite.6.dylib
#####brew cleanup
bash
1Brew cleanup 2 3Pruned 1 symbolic links from /usr/local
#####再度確認
bash
1Brew doctor 2 3Your system is ready to brew.
#####composerをインストール
bash
1Brew install composer 2 3MY_NAME:/ MY_NAME$ brew install composer 4==> Downloading https://getcomposer.org/download/1.9.2/composer.phar 5######################################################################## 100.0% 6???? /usr/local/Cellar/composer/1.9.2: 3 files, 1.8MB, built in 8 seconds 7 8 9 10 11 ______ 12 / ____/___ ____ ___ ____ ____ ________ _____ 13 / / / __ / __ `__ / __ / __ / ___/ _ / ___/ 14/ /___/ /_/ / / / / / / /_/ / /_/ (__ ) __/ / 15\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/ 16 /_/ 17Composer version 1.9.2 2020-01-14 16:30:31 18 19Usage: 20 command [options] [arguments] 21 22Options: 23 -h, --help Display this help message 24 -q, --quiet Do not output any message 25 -V, --version Display this application version 26 --ansi Force ANSI output 27 --no-ansi Disable ANSI output 28 -n, --no-interaction Do not ask any interactive question 29 --profile Display timing and memory usage information 30 --no-plugins Whether to disable plugins. 31 -d, --working-dir=WORKING-DIR If specified, use the given directory as working directory. 32 --no-cache Prevent use of the cache 33 -v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug 34 35Available commands: 36 about Shows the short information about Composer. 37 archive Creates an archive of this composer package. 38 browse Opens the package's repository URL or homepage in your browser. 39 check-platform-reqs Check that platform requirements are satisfied. 40 clear-cache Clears composer's internal package cache. 41 clearcache Clears composer's internal package cache. 42 config Sets config options. 43 create-project Creates new project from a package into given directory. 44 depends Shows which packages cause the given package to be installed. 45 diagnose Diagnoses the system to identify common errors. 46 dump-autoload Dumps the autoloader. 47 dumpautoload Dumps the autoloader. 48 exec Executes a vendored binary/script. 49 global Allows running commands in the global composer dir ($COMPOSER_HOME). 50 help Displays help for a command 51 home Opens the package's repository URL or homepage in your browser. 52 i Installs the project dependencies from the composer.lock file if present, or falls back on the composer.json. 53 info Shows information about packages. 54 init Creates a basic composer.json file in current directory. 55 install Installs the project dependencies from the composer.lock file if present, or falls back on the composer.json. 56 licenses Shows information about licenses of dependencies. 57 list Lists commands 58 outdated Shows a list of installed packages that have updates available, including their latest version. 59 prohibits Shows which packages prevent the given package from being installed. 60 remove Removes a package from the require or require-dev. 61 require Adds required packages to your composer.json and installs them. 62 run Runs the scripts defined in composer.json. 63 run-script Runs the scripts defined in composer.json. 64 search Searches for packages. 65 self-update Updates composer.phar to the latest version. 66 selfupdate Updates composer.phar to the latest version. 67 show Shows information about packages. 68 status Shows a list of locally modified packages, for packages installed from source. 69 suggests Shows package suggestions. 70 u Upgrades your dependencies to the latest version according to composer.json, and updates the composer.lock file. 71 update Upgrades your dependencies to the latest version according to composer.json, and updates the composer.lock file. 72 upgrade Upgrades your dependencies to the latest version according to composer.json, and updates the composer.lock file. 73 validate Validates a composer.json and composer.lock. 74 why Shows which packages cause the given package to be installed. 75 why-not Shows which packages prevent the given package from being installed.
###composerのパスを追加
bash
1export PATH="~/.composer/vendor/bin:$PATH" 2 3 4#####laravelのインストール 5```bash 6composer global require "laravel/installer=~1.1"
#エラー内容
bash
1/Application/MAMP/htdocs $ laravel new project 2 3In NewCommand.php line 42: 4 5 The Zip PHP extension is not installed. Please install it and try again. 6 7new [--dev] [--5.2] [--] [<name>]
"phpの拡張でzipがないから、インストールして再度試して下さい。"のようなことが書かれているとおもいます。
検索してみると、brewコマンドでcomposerをインストールした際には
といった内容が多くみられました。brewコマンドで動くことは確認が取れたのですが、なぜ、brewコマンドてphpをインストールすると動作してインストールしないと動かなかったのかが気になり、別の方法で対応できればとおもい、質問させていただきました。
###試したこと
MAMP内のphp.iniを編集する事で対応できるかと考えましたが、うまくできず。
検索すると"brewでphpをインストールしてください。"といった内容が多くありました。
brew コマンドにてphpをインストールしたらこのエラーは解消されました。
##問題点・聞きたいこと
なぜbrewコマンドでインストールしたPHPの場合動作したのか伺いたいです。
また、もしMAMPのPHPで動作させたいと思った場合はどの様な所処置が必要なのでしょうか。
(WindowsとXAMPPの環境で例えるとComposerをインストールする際に
XAMPP内のphp.exeを指定するイメージです。)
投稿内容に不備、不足等あればお手数ですがご指摘いただきたいです。
お力添えよろしくお願いいたします。
回答1件
あなたの回答
tips
プレビュー