laravelでプロジェクトを作って、ハローワールドをしようとしているところです。
プロジェクトフォルダの中のroutesのなかのweb.phpの中に追記して、routingの仕組みを学ぼう!ってところなんですが、500エラーがでて、どうやって解決したらいいのかわかりません。
一応、追記部分を下に載せておきます。
アドバイスお願いいたします。
ファイルは以下に置いています。
C:\xampp\htdocs\laravelapp\routes\web.php
XAMPPのv3.2.2です
phpは7.1.11です
laravelはLaravel Framework 5.5.21です
追記:XAMPPをつかわないで、
php artisan serve
を使って動かしたら、動きました。
ソースの問題というより、設定の問題みたいです。
どうやったら、XAMPPのほうで動かせるようになるんでしょうか。何を確認したほうがいいかほかにありましたら、ご教授ください。
$html = <<<EOF
<html>
<head>
<title>Hello</title>
<style>
body {font-size:16pt; color:#999;}
h1 { font-size:100pt; text-align:right; color:#eee;
margin:40px 0px -50px 0px;}
</style>
</head>
<body>
<h1>Hello</h1>
<p>This is sample page.</p>
<p>これはサンプルページです。</p>
</body>
</html>
EOF;
Route::get('hello', function () use ($html) {
return $html;
});
n Nov 20 22:02:37.193657 2017] [core:error] [pid 16616:tid 1928] [client ::1:52592] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
[Mon Nov 20 22:02:37.193657 2017] [core:error] [pid 16616:tid 1928] [client ::1:52592] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
[Mon Nov 20 22:02:56.160334 2017] [core:error] [pid 16616:tid 1928] [client ::1:52595] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
[Mon Nov 20 22:02:56.160334 2017] [core:error] [pid 16616:tid 1928] [client ::1:52595] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
[Mon Nov 20 22:05:36.895584 2017] [core:error] [pid 16616:tid 1936] [client ::1:52608] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
[Mon Nov 20 22:05:36.895584 2017] [core:error] [pid 16616:tid 1936] [client ::1:52608] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
[Mon Nov 20 22:06:04.273001 2017] [core:error] [pid 16616:tid 1928] [client ::1:52610] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
[Mon Nov 20 22:06:04.273001 2017] [core:error] [pid 16616:tid 1928] [client ::1:52610] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
[Mon Nov 20 22:56:32.104683 2017] [core:error] [pid 16616:tid 1936] [client ::1:52803] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
[Mon Nov 20 22:56:32.104683 2017] [core:error] [pid 16616:tid 1936] [client ::1:52803] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
[Mon Nov 20 22:56:51.642341 2017] [ssl:warn] [pid 5792:tid 560] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Mon Nov 20 22:56:51.678279 2017] [core:warn] [pid 5792:tid 560] AH00098: pid file C:/xampp/apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[Mon Nov 20 22:56:51.747466 2017] [ssl:warn] [pid 5792:tid 560] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Mon Nov 20 22:56:51.768522 2017] [mpm_winnt:notice] [pid 5792:tid 560] AH00455: Apache/2.4.29 (Win32) OpenSSL/1.0.2l PHP/7.1.11 configured -- resuming normal operations
[Mon Nov 20 22:56:51.768522 2017] [mpm_winnt:notice] [pid 5792:tid 560] AH00456: Apache Lounge VC14 Server built: Oct 22 2017 11:52:30
[Mon Nov 20 22:56:51.768522 2017] [core:notice] [pid 5792:tid 560] AH00094: Command line: 'c:\\xampp\\apache\\bin\\httpd.exe -d C:/xampp/apache'
[Mon Nov 20 22:56:51.770527 2017] [mpm_winnt:notice] [pid 5792:tid 560] AH00418: Parent: Created child process 2956
[Mon Nov 20 22:56:52.236293 2017] [ssl:warn] [pid 2956:tid 580] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Mon Nov 20 22:56:52.339533 2017] [ssl:warn] [pid 2956:tid 580] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Mon Nov 20 22:56:52.362407 2017] [mpm_winnt:notice] [pid 2956:tid 580] AH00354: Child: Starting 150 worker threads.
[Mon Nov 20 22:57:14.859532 2017] [core:error] [pid 2956:tid 1932] [client ::1:52829] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
[Mon Nov 20 22:57:14.859532 2017] [core:error] [pid 2956:tid 1932] [client ::1:52829] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
-
気になる質問をクリップする
クリップした質問は、後からいつでもマイページで確認できます。
またクリップした質問に回答があった際、通知やメールを受け取ることができます。
クリップを取り消します
-
良い質問の評価を上げる
以下のような質問は評価を上げましょう
- 質問内容が明確
- 自分も答えを知りたい
- 質問者以外のユーザにも役立つ
評価が高い質問は、TOPページの「注目」タブのフィードに表示されやすくなります。
質問の評価を上げたことを取り消します
-
評価を下げられる数の上限に達しました
評価を下げることができません
- 1日5回まで評価を下げられます
- 1日に1ユーザに対して2回まで評価を下げられます
質問の評価を下げる
teratailでは下記のような質問を「具体的に困っていることがない質問」、「サイトポリシーに違反する質問」と定義し、推奨していません。
- プログラミングに関係のない質問
- やってほしいことだけを記載した丸投げの質問
- 問題・課題が含まれていない質問
- 意図的に内容が抹消された質問
- 過去に投稿した質問と同じ内容の質問
- 広告と受け取られるような投稿
評価が下がると、TOPページの「アクティブ」「注目」タブのフィードに表示されにくくなります。
質問の評価を下げたことを取り消します
この機能は開放されていません
評価を下げる条件を満たしてません
質問の評価を下げる機能の利用条件
この機能を利用するためには、以下の事項を行う必要があります。
- 質問回答など一定の行動
-
メールアドレスの認証
メールアドレスの認証
-
質問評価に関するヘルプページの閲覧
質問評価に関するヘルプページの閲覧
+1
500エラーの場合は、内部エラーとしてLaravelアプリのstorage/logsにあるログにエラー内容が出力されているので確認してみてください。
Laravelのlogが出力されない時は、その前段階のエラーとしてApacheやNginx等のWebサーバーのログを確認してみてください
Laravel 5.5 エラーとログ
投稿
-
回答の評価を上げる
以下のような回答は評価を上げましょう
- 正しい回答
- わかりやすい回答
- ためになる回答
評価が高い回答ほどページの上位に表示されます。
-
回答の評価を下げる
下記のような回答は推奨されていません。
- 間違っている回答
- 質問の回答になっていない投稿
- スパムや攻撃的な表現を用いた投稿
評価を下げる際はその理由を明確に伝え、適切な回答に修正してもらいましょう。
+1
提示頂いたコードをroutes/web.php
に貼り付けてみましたが正常に出力されますね。
上記のコードの問題ではない様です。
ちなみにアクセスしているURLは正しいでしょうか?ローカルホストであれば
http://localhost/ディレクトリ名/public/hello
となりますが…
後は、ディレクトリのパーミッションの確認をしてみると良いかもしれません。
こちらのサイトの様なケースがあるようです。
投稿
-
回答の評価を上げる
以下のような回答は評価を上げましょう
- 正しい回答
- わかりやすい回答
- ためになる回答
評価が高い回答ほどページの上位に表示されます。
-
回答の評価を下げる
下記のような回答は推奨されていません。
- 間違っている回答
- 質問の回答になっていない投稿
- スパムや攻撃的な表現を用いた投稿
評価を下げる際はその理由を明確に伝え、適切な回答に修正してもらいましょう。
0
公式サイトの記事もありますが、それで分かりづらければQiitaなどのまとめ記事を読むと良いです。
PHPやlaravelのバージョンもご提示いただければもっと適切な回答がつくとは思いますが・・・。
投稿
-
回答の評価を上げる
以下のような回答は評価を上げましょう
- 正しい回答
- わかりやすい回答
- ためになる回答
評価が高い回答ほどページの上位に表示されます。
-
回答の評価を下げる
下記のような回答は推奨されていません。
- 間違っている回答
- 質問の回答になっていない投稿
- スパムや攻撃的な表現を用いた投稿
評価を下げる際はその理由を明確に伝え、適切な回答に修正してもらいましょう。
15分調べてもわからないことは、teratailで質問しよう!
- ただいまの回答率 88.34%
- 質問をまとめることで、思考を整理して素早く解決
- テンプレート機能で、簡単に質問をまとめられる
質問への追記・修正、ベストアンサー選択の依頼
m.ts10806
2017/11/21 09:26 編集
提示のソースはどこの何を提示されているのでしょうか。ファイルが違うのであれば、ファイル名やフォルダ構成・階層なども明記してください。また、プログラムコードはコードブロック(```)で囲ってください。
harpy
2017/11/21 20:04
提示のソースはC:\xampp\htdocs\laravelapp\routes\web.phpのものです
harpy
2017/11/21 20:17
正しい質問の仕方もわからないのでご指摘いただきありがとうございます。