[英]Internal Server Error while run laravel on localhost
我是 Laravel 的初學者。 現在,我想在本地主機上運行 laravel 項目。 現在,我做了什么? 我在resource/view/index.blade.php
創建了index.blade.php
文件並在routes/web.php
修改了web.php
文件
路線/ web.php
<?php
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
Route::get('index', function () {
return view('index');
});
資源/視圖/index.blade.php
<!doctype html>
<html>
<head>
<title>Demo</title>
</head>
<body>
<h1>Laravel start</h1>
</body>
</html>
我已將server.php
更改為index.php
並將.htaccess
文件從public
移動到根目錄並重新啟動apache
服務器。 但它向我顯示500 Internal Server Error
。 我已經運行localhost/laravel
但它不工作。 那么,我該如何解決這個問題? 請幫我。
發生錯誤
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator at webmaster@dummy-host2.example.com to inform them of the time this error occurred, and the actions you performed just before this error.
More information about this error may be available in the server error log.
Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.
Apache/2.4.29 (Win32) OpenSSL/1.0.2l PHP/5.6.32 Server at localhost Port 80
謝謝你
after fresh install , just run command "php artisan serve" ,
because server.php is modified to run server on any directory without putting project in xampp\htdocs ,
If You want to run through localhost replace index.php and .htaccess from public to root directory of project
hope this helps :)
如果您只需要創建新文件夾或文件,然后按您所知的方式運行它,請不要更改 laravel 項目上的任何文件。
如果你只想運行 laravel 項目,你可以運行它,但如果你想使用數據庫,你應該使用 xampp 或 wampp localhost 服務器。
希望你能成功。
這可能是由於各種問題:
您需要一一測試,例如創建一個單獨的文件夾,然后在一個新文件中使用簡單的echo "I am here";
看看它是否有效。
下一步您需要檢查命令或替代
然后你需要檢查文件夾和文件的權限
如果問題仍然存在,則可能需要檢查服務器設置。
如果你們已經從遠程存儲庫或本地項目克隆了項目
這樣我就解決了我的問題。 也希望能幫到你!!!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.