質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
Laravel

LaravelとはTaylor Otwellによって開発された、オープンソースなPHPフレームワークです。Laravelはシンプルで表現的なシンタックスを持ち合わせており、ウェブアプリケーション開発の手助けをしてくれます。

MacOS(OSX)

MacOSとは、Appleの開発していたGUI(グラフィカルユーザーインターフェース)を採用したオペレーションシステム(OS)です。Macintoshと共に、市場に出てGUIの普及に大きく貢献しました。

PHP

PHPは、Webサイト構築に特化して開発されたプログラミング言語です。大きな特徴のひとつは、HTMLに直接プログラムを埋め込むことができるという点です。PHPを用いることで、HTMLを動的コンテンツとして出力できます。HTMLがそのままブラウザに表示されるのに対し、PHPプログラムはサーバ側で実行された結果がブラウザに表示されるため、PHPスクリプトは「サーバサイドスクリプト」と呼ばれています。

composer

Composerとは、PHP5.3.2以上で使用可能なパッケージ管理ツールです。指定ディレクトリ内だけでパッケージ管理します。

MAMP

Mac 上で WordPress などの動的ページのサイトが作れるように環境を構築するフリーソフト

Q&A

解決済

1回答

2804閲覧

$laravel new コマンドでエラー

chichiyanagi

総合スコア10

Laravel

LaravelとはTaylor Otwellによって開発された、オープンソースなPHPフレームワークです。Laravelはシンプルで表現的なシンタックスを持ち合わせており、ウェブアプリケーション開発の手助けをしてくれます。

MacOS(OSX)

MacOSとは、Appleの開発していたGUI(グラフィカルユーザーインターフェース)を採用したオペレーションシステム(OS)です。Macintoshと共に、市場に出てGUIの普及に大きく貢献しました。

PHP

PHPは、Webサイト構築に特化して開発されたプログラミング言語です。大きな特徴のひとつは、HTMLに直接プログラムを埋め込むことができるという点です。PHPを用いることで、HTMLを動的コンテンツとして出力できます。HTMLがそのままブラウザに表示されるのに対し、PHPプログラムはサーバ側で実行された結果がブラウザに表示されるため、PHPスクリプトは「サーバサイドスクリプト」と呼ばれています。

composer

Composerとは、PHP5.3.2以上で使用可能なパッケージ管理ツールです。指定ディレクトリ内だけでパッケージ管理します。

MAMP

Mac 上で WordPress などの動的ページのサイトが作れるように環境を構築するフリーソフト

0グッド

0クリップ

投稿2020/01/27 13:33

編集2020/01/27 14:38

#実現したいこと
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を指定するイメージです。)

投稿内容に不備、不足等あればお手数ですがご指摘いただきたいです。

お力添えよろしくお願いいたします。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

m.ts10806

2020/01/27 13:37

エラーに何をしたら良いの書いてありますけど、どこまで調べて試したのでしょうか。 >The Zip PHP extension is not installed. Please install it and try again. ただ、brewが推奨されているはずで、あえてそれ以外の方法で行くのは如何なものかと(自己責任で対応しきれないのなら選ぶメリット皆無です)
chichiyanagi

2020/01/27 13:50

度々回答ありがとうございます。 エラーには"phpの拡張でzipがないから、インストールして再度試して下さい。"のようなことが書かれているとおもいます。 php.iniを編集する事で対応できるかと考えましたが、うまくできず。 検索してみると、brewコマンドでcomposerをインストールした際には brewでphpをインストールしてください。といった内容が多くみられました。brewコマンドで動くことは確認が取れたのですが、なぜ、brewコマンドてphpをインストールすると動作してインストールしないと動かなかったのかが気になり、別の方法で対応できればとおもい、質問させていただきました。
m.ts10806

2020/01/27 13:53

こちらは回答ではなく質問への追記修正依頼のコメント欄です。 基本的に質問を編集して返してください。
chichiyanagi

2020/01/27 14:40

失礼いたしました。質問を編集いたしましたので、確認していただけると幸いです。
guest

回答1

0

ベストアンサー

なぜbrewコマンドでインストールしたPHPの場合動作したのか伺いたいです

「Laravel導入に必要なものが全て付属の状態でPHPがインストールされるから」に他なりません。
パッケージ管理ツールの利点はそこです。
Composerもその内ですが、依存関係を自動で解決してくれます。

Aというパッケージを利用する場合にはAからBというパッケージを利用している・・・
のでそこをうまいことやってくれてBも一緒に導入してくれるのがパッケージ管理ツールです。

Laravelのドキュメントにもしっかり書かれています。

インストール6.x

Laravelフレームワークを動作させるには多少のシステム要件があります。Laravel Homestead仮想マシンでは、要求が全て満たされています。そのため、Laravelのローカル開発環境としてHomesteadを活用されることを強くおすすめします。
しかし、Homesteadを使用しない場合は、以下の要件を満たす必要があります。
以下略

「そういうツール使わないなら自分で確認して自分で全部入れてね」という意味です。

投稿2020/01/27 14:51

m.ts10806

総合スコア80765

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

chichiyanagi

2020/01/28 00:43

回答ありがとうございます。 この領域の話を理解するには私のスキルがまだまだ足りないようなので、 今はこういうものだと思って頑張りたいと思います。 また、質問をするかと思いますが、その際はよろしくお願いいたします。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問