首先,我对拉瑞维尔很陌生,
第二次我从GitHub克隆了一个项目
我正在尝试启动laravel开发服务器|php工匠服务但它给我这个错误:
php artisan serve
Starting Laravel development server: http://127.0.0.1:8000
[Sun Nov 27 08:38:27 2022] PHP 8.1.13 Development Server (http://127.0.0.1:8000) started
[Sun Nov 27 08:38:36 2022] 127.0.0.1:42986 Accepted
[Sun Nov 27 08:38:36 2022] PHP Warning: require_once(/home/almando/Documents/laravelPro/amazy-ecommerce/public/index.php): Failed to open stream: No such file or directory in /home/almando/Documents/laravelPro/amazy-ecommerce/server.php on line 21
[Sun Nov 27 08:38:36 2022] PHP Fatal error: Uncaught Error: Failed opening required '/home/almando/Documents/laravelPro/amazy-ecommerce/public/index.php' (include_path='.:/usr/share/php') in /home/almando/Documents/laravelPro/amazy-ecommerce/server.php:21
Stack trace:
#0 {main}
thrown in /home/almando/Documents/laravelPro/amazy-ecommerce/server.php on line 21
[Sun Nov 27 08:38:36 2022] 127.0.0.1:42986 Closing
[Sun Nov 27 08:38:36 2022] 127.0.0.1:42992 Accepted
[Sun Nov 27 08:38:36 2022] 127.0.0.1:43000 Accepted
[Sun Nov 27 08:38:47 2022] PHP Warning: require_once(/home/almando/Documents/laravelPro/amazy-ecommerce/public/index.php): Failed to open stream: No such file or directory in /home/almando/Documents/laravelPro/amazy-ecommerce/server.php on line 21
[Sun Nov 27 08:38:47 2022] PHP Fatal error: Uncaught Error: Failed opening required '/home/almando/Documents/laravelPro/amazy-ecommerce/public/index.php' (include_path='.:/usr/share/php') in /home/almando/Documents/laravelPro/amazy-ecommerce/server.php:21
Stack trace:
#0 {main}
thrown in /home/almando/Documents/laravelPro/amazy-ecommerce/server.php on line 21
//////////////////////////////////////////////
在引导程序/App. php中
<?php
/*
|--------------------------------------------------------------------------
| Create The Application
|--------------------------------------------------------------------------
|
| The first thing we will do is create a new Laravel application instance
| which serves as the "glue" for all the components of Laravel, and is
| the IoC container for the system binding all of the various parts.
|
*/
$app = new Illuminate\Foundation\Application(
$_ENV['APP_BASE_PATH'] ?? dirname(__DIR__)
);
/*
|--------------------------------------------------------------------------
| Bind Important Interfaces
|--------------------------------------------------------------------------
|
| Next, we need to bind some important interfaces into the container so
| we will be able to resolve them when needed. The kernels serve the
| incoming requests to this application from both the web and CLI.
|
*/
$app->singleton(
Illuminate\Contracts\Http\Kernel::class,
App\Http\Kernel::class
);
$app->singleton(
Illuminate\Contracts\Console\Kernel::class,
App\Console\Kernel::class
);
$app->singleton(
Illuminate\Contracts\Debug\ExceptionHandler::class,
App\Exceptions\Handler::class
);
/*
|--------------------------------------------------------------------------
| Return The Application
|--------------------------------------------------------------------------
|
| This script returns the application instance. The instance is given to
| the calling script so we can separate the building of the instances
| from the actual running of the application and sending responses.
|
*/
return $app;
/////////////////////////////////////
在服务器. php中
<?php
/**
* Laravel - A PHP Framework For Web Artisans
*
* @package Laravel
* @author Taylor Otwell <taylor@laravel.com>
*/
$uri = urldecode(
parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)
);
// This file allows us to emulate Apache's "mod_rewrite" functionality from the
// built-in PHP web server. This provides a convenient way to test a Laravel
// application without having installed a "real" web server software here.
if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri)) {
return false;
}
require_once __DIR__.'/public/index.php';
///////////////////////////////////////////
在index.php中
<?php
use Illuminate\Contracts\Http\Kernel;
use Illuminate\Http\Request;
define('LARAVEL_START', microtime(true));
/*
|--------------------------------------------------------------------------
| Check If Application Is Under Maintenance
|--------------------------------------------------------------------------
|
| If the application is maintenance / demo mode via the "down" command we
| will require this file so that any prerendered template can be shown
| instead of starting the framework, which could cause an exception.
|
*/
if (file_exists(__DIR__.'/storage/framework/maintenance.php')) {
require __DIR__.'/storage/framework/maintenance.php';
}
/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader for
| this application. We just need to utilize it! We'll simply require it
| into the script here so we don't need to manually load our classes.
|
*/
require __DIR__.'/vendor/autoload.php';
/*
|--------------------------------------------------------------------------
| Run The Application
|--------------------------------------------------------------------------
|
| Once we have the application, we can handle the incoming request using
| the application's HTTP kernel. Then, we will send the response back
| to this client's browser, allowing them to enjoy our application.
|
*/
$app = require_once __DIR__.'/bootstrap/app.php';
$kernel = $app->make(Kernel::class);
$response = tap($kernel->handle(
$request = Request::capture()
))->send();
$kernel->terminate($request, $response);
////////////////////////////////////////////////////////////
在浏览器中显示:
此页面无法使用
127.0.0.1 当前无法处理此请求。
HTTP错误500
///////////////////////////////////////////////////////////////
就像我说的,我是新来的laravel,我没有做太多,但我试图阅读一些类似的问题,但没有找到任何解决这个问题的办法,因为我不明白它,我有点困惑,不想搞砸它。
所以请帮帮我!
2条答案
按热度按时间q43xntqr1#
我相信这是因为你没有安装依赖项。
如果您确实没有运行
composer install
,请从项目根目录运行它,然后再次运行php artisan serve
olqngx592#
如果您没有安装composer话
如果已安装了
然后,