前提
xamppを使いLaravelでアプリを作った。
githubにpushし、xserver側でpullした後、公開のためシンボリックリンクを作成して該当urlにアクセスしたところエラーが発生した。
実現したいこと
公開できるようにしたい
発生している問題・エラーメッセージ
Fatal error: Failed opening required '/home/ドメイン名/ドメイン名.xsrv.jp/public_html/public/index.php' (include_path='.:/opt/php-8.1.6/data/pear') in Unknown on line 0
該当のソースコード
index.php
1<?php 2 3use Illuminate\Contracts\Http\Kernel; 4use Illuminate\Http\Request; 5 6define('LARAVEL_START', microtime(true)); 7 8/* 9|-------------------------------------------------------------------------- 10| Check If The Application Is Under Maintenance 11|-------------------------------------------------------------------------- 12| 13| If the application is in maintenance / demo mode via the "down" command 14| we will load this file so that any pre-rendered content can be shown 15| instead of starting the framework, which could cause an exception. 16| 17*/ 18 19if (file_exists($maintenance = __DIR__.'/../storage/framework/maintenance.php')) { 20 require $maintenance; 21} 22 23/* 24|-------------------------------------------------------------------------- 25| Register The Auto Loader 26|-------------------------------------------------------------------------- 27| 28| Composer provides a convenient, automatically generated class loader for 29| this application. We just need to utilize it! We'll simply require it 30| into the script here so we don't need to manually load our classes. 31| 32*/ 33 34require __DIR__.'/../vendor/autoload.php'; 35 36/* 37|-------------------------------------------------------------------------- 38| Run The Application 39|-------------------------------------------------------------------------- 40| 41| Once we have the application, we can handle the incoming request using 42| the application's HTTP kernel. Then, we will send the response back 43| to this client's browser, allowing them to enjoy our application. 44| 45*/ 46 47$app = require_once __DIR__.'/../bootstrap/app.php'; 48 49$kernel = $app->make(Kernel::class); 50 51$response = $kernel->handle( 52 $request = Request::capture() 53)->send(); 54 55$kernel->terminate($request, $response); 56
試したこと
php -S localhost:8000 -t public
server.phpを作成してルードディレクトリに置く
補足情報(FW/ツールのバージョンなど)
ここにより詳細な情報を記載してください。
composerパッケージのインストールとか必要だと思いますが、その辺の対応はされているのでしょうか? XServerのようなレンタルサーバでLaravelを動かすにはそれなりの工夫が必要だと思いますが、その辺はしっかり把握されて、かつ対応されているでしょうか?
参考)
https://chigusa-web.com/blog/xserver-laravel-github/
どの辺まで対応されているかが質問文だけでは分かりませんので、明確な回答が出てくるのは厳しいかと思います。デプロイの方法など、もう少し詳細に質問文内に書いて頂ければ、回答が出てくるかもしれません。
失礼いたしました。説明不足でした。
回答ありがとうございます。
先ほど何故かは分かりませんが、php artisan storage:linkをプロジェクトフォルダで実行したところ上手くいきました。
回答1件
あなたの回答
tips
プレビュー