我是laravel的初学者。现在,我想在本地主机上运行laravel项目。现在,我做了什么?我在index.blade.php
内创建了resource/view/index.blade.php
文件,并在web.php
内修改了routes/web.php
文件
routes / 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');
});
resources / view / 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
谢谢
答案 0 :(得分:0)
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 :)
答案 1 :(得分:0)
如果只需要创建新的文件夹或文件,然后运行它就可以了,请不要在laravel项目上更改任何文件。
如果只想运行laravel项目,则可以运行它,但是如果要使用数据库,则应使用xampp或wampp localhost服务器。
希望您会成功。
答案 2 :(得分:0)
可能由于各种问题:
您需要逐个测试,例如创建一个单独的文件夹,然后使用简单的echo "I am here";
在一个新文件中,看看它是否有效。
下一步,您需要检查命令或替代项
然后您需要检查文件夹和文件的权限
如果仍然存在,则可能需要检查服务器设置。