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

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

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

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

PHP

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

XAMPP

XAMPP(ザンプ)は、ウェブアプリケーションの実行に必要なフリーソフトウェアをパッケージングしたApacheディストリビューションです。 XAMPPひとつインストールするだけで、Apache、MySQL、PHP、Perlなどのソフトウェアと、 phpMyAdminなどの管理ツール、SQLiteなどのソフトウェアやライブラリモジュールなどを利用することが可能です。

MAMP

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

Q&A

2回答

1378閲覧

LaravelのプロジェクトをMAMPかXAMPPを使って表示したい

ryo_03

総合スコア0

Laravel

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

PHP

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

XAMPP

XAMPP(ザンプ)は、ウェブアプリケーションの実行に必要なフリーソフトウェアをパッケージングしたApacheディストリビューションです。 XAMPPひとつインストールするだけで、Apache、MySQL、PHP、Perlなどのソフトウェアと、 phpMyAdminなどの管理ツール、SQLiteなどのソフトウェアやライブラリモジュールなどを利用することが可能です。

MAMP

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

0グッド

0クリップ

投稿2022/06/26 14:44

LaravelのプロジェクトをMAMPかXAMPPを使って表示したいのですが,できないので教えていただきたいです.以前まではMAMPを使用して問題なく表示をすることができていました.
現在はMacを使用しており,macOS Montereyのバージョン12.3.1です.
また,composerのバージョンは2.3.7です.

MAMP

以前までに作成したlaravelのプロジェクト(laravelapp)は今でも問題なくgoogle Chromeを使用して表示することができます.以前に作成したもののバージョンは以下のとおりです.

  • laravelのバージョン 9.6.0
  • MAMPのPHPのバージョン 8.0.8
  • パソコンのPHPのバージョン 8.1.1

また,新しく作成したプロジェクトのバージョンは以下のとおりです.

  • laravelのバージョン 9.18.0
  • MAMPのPHPのバージョン 8.0.8
  • パソコンのPHPのバージョン 8.1.1

新しく作成したプロジェクトに(http://localhost/laravelSample/public/) でアクセスしようとしたら以下のようなエラーが出ます.

エラー内容

Fatal error: Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.1.0". You are running 8.0.8. in /Applications/MAMP/htdocs/laravelSample/vendor/composer/platform_check.php on line 24```

試したこと

laravelのバージョンが問題かと思い9.6.0のバージョンで作成しようとしたのですが作成方法がわからず,(composer create-project --prefer-dist laravel/laravel=8.* laravelSample8)のコマンドで8.83.17のバージョンのプロジェクトを作成しました.
その結果は,同じく上記のエラーが出ました.

また,MAMPproを使用してPHPのバージョンが8.1.0以降のものにするのはできれば避けたいです.

ですので次にXAMPPを使用しようとしました.

XAMPP

XAMPPはxampp-osx-8.1.6-0-vmをダウンロードしました.
htdocsにlaravelのプロジェクト(バージョンは9.18.0)(プロジェクト名はtest9)を作成し,(http://localhost:8080/test9/public/) でアクセスしようとしたら以下のエラーが出てきました.

エラー内容

The stream or file "/opt/lampp/htdocs/test9/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied The exception occurred while attempting to log: The stream or file "/opt/lampp/htdocs/test9/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied The exception occurred while attempting to log: The stream or file "/opt/lampp/htdocs/test9/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied The exception occurred while attempting to log: The stream or file "/opt/lampp/htdocs/test9/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied The exception occurred while attempting to log: The stream or file "/opt/lampp/htdocs/test9/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied The exception occurred while attempting to log: The stream or file "/opt/lampp/htdocs/test9/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied The exception occurred while attempting to log: The stream or file "/opt/lampp/htdocs/test9/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied The exception occurred while attempting to log: The stream or file "/opt/lampp/htdocs/test9/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied The exception occurred while attempting to log: The stream or file "/opt/lampp/htdocs/test9/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied The exception occurred while attempting to log: The stream or file "/opt/lampp/htdocs/test9/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied The exception occurred while attempting to log: The stream or file "/opt/lampp/htdocs/test9/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied The exception occurred while attempting to log: The stream or file "/opt/lampp/htdocs/test9/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied The exception occurred while attempting to log: The stream or file "/opt/lampp/htdocs/test9/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied The exception occurred while attempting to log: The stream or file "/opt/lampp/htdocs/test9/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied The exception occurred while attempting to log: The stream or file "/opt/lampp/htdocs/test9/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied The exception occurred while attempting to log: The stream or file "/opt/lampp/htdocs/test9/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied The exception occurred while attempting to log: file_put_contents(/opt/lampp/htdocs/test9/storage/framework/views/358427817b4c28094d977956fd5179e449217ffe.php): Failed to open stream: Permission denied Context: {"exception":{}} Context: {"exception":{}} Context: {"exception":{}} Context: {"exception":{}} Context: {"exception":{}} Context: {"exception":{}} Context: {"exception":{}} Context: {"exception":{}} Context: {"exception":{}} Context: {"exception":{}} Context: {"exception":{}} Context: {"exception":{}} Context: {"exception":{}} Context: {"exception":{}} Context: {"exception":{}} Context: {"exception":{}}

試したこと

作成したlaravelのプロジェクトに問題があるのではないかと思い,作成したlaravelのプロジェクトでphp artisan serveのコマンドを使用し,(http://127.0.0.1:8000) にアクセスしたところ問題なくlaravelの初期のページが表示されました.

laravelとMAMPやXAMPPを最近触り始めたので初歩の質問かもしれませんが,よろしくお願い致します.

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

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

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

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

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

m.ts10806

2022/06/26 23:59

>パソコンのPHPのバージョン 8.1.1 こっちのPHPにパスを通せば良いのでは?
退会済みユーザー

退会済みユーザー

2022/06/27 01:33

せっかくなら、MAMPのコントロールパネルからPHPバージョン変更ができるように細工するとか。
ryo_03

2022/06/27 05:40

m.ts10806さんコメントありがとうございます. パソコンのPHPのバージョン8.1.1にパスを通すとはどのようにすればいいでしょうか? 初歩の質問かもしれませんがよろしくお願い致します.
ryo_03

2022/06/27 05:43

sPy2bUDOZ4uRa7tさんコメントありがとうございます. MAMPのコントロールパネルからPHPバージョン変更が出来るようするのはMAMP PROを利用する以外の方法はあるということですか? MAMPでは2種類(現在は7.4.21 or 8.0.8)しか選択できないと思うのですが... なにか良い方法があれば教えていただきたいです. よろしくお願い致します.
退会済みユーザー

退会済みユーザー

2022/06/27 07:17

「パソコンのPHP」と言っているものはmac上で動かせているものですか?
guest

回答2

0

macならMAMPで構築した方が、
個々のソフトウェア間の調整ごとの多くを省けるので楽なのではないでしょうか。

ただし、MAMPでもXAMPPでもパッケージ化された時点のPHPバージョンが古い場合には、
仕方なくPHPだけでも最新版を入れ直すことになるかと思います。

mac向けの、PHP最新版に入れ直す記事をピックアップしました:
Macのローカル開発環境のMAMPをアップグレードする方法 | Free Style

あるいは、MySQLのデータベースのバックアップを取った上で、
MAMPの最新版に入れ直す方が簡単かもしれません。

macOS の MAMP をサクッとアップデートする方法 | Webgroove

あと、MAMPから選択できるPHPを変更する方法の記事もありました。
MAMPでPHPのバージョンを変更する | cly7796.net
然るべき箇所にPHP本体を移動(もしくはコピー)しておくことになりますが。

HomeBrewを使ってPHP最新版をMacに入れる記事は、例えば
HomebrewでM1 MacにPHP 8.1をインストールする手順 | オブわか!
などありますが、
個別にApache httpdとPHPを入れて連携させるまでの手順を示した記事もあります:
M1 MontereyにApacheとPHPの環境を構築する方法-ICHIKEN@エンジニアキャンパーのバエないアメリカ生活

投稿2022/06/27 00:06

編集2022/06/27 07:25
退会済みユーザー

退会済みユーザー

総合スコア0

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

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

ryo_03

2022/06/27 05:38

回答ありがとうございます. MAMPのVersionが現在6.6でリリースされている最新のVersionも6.6なのでMAMPの最新版がすでにダウンロードされている状態です. 僕の情報の書き込み不足でした. 申し訳ございません.
guest

0

MMAPは、apacheのコンフィグファイルで、ログの出力場所を調整すれば、治るとおもいます。

投稿2022/06/28 04:19

hanamako

総合スコア23

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

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

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだベストアンサーが選ばれていません

会員登録して回答してみよう

アカウントをお持ちの方は

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

ただいまの回答率
85.51%

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

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

質問する

関連した質問