lumen、laravel 环境问题汇总

框架报500

1.chmod 777 -R storage 将日志目录权限设置下。
2.修改fastcgi,将代码目录包含进去。

fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root/:/tmp/:/proc/:/home/www/";

3.nginx.conf

location / {
	try_files $uri $uri/ /index.php$is_args$query_string;
}

No application encryption key has been specified.

1、.env.example 改名使用命令 copy 修改为 .env
2、使用命令 php artisan key:generate 获取密码

[IlluminateContractsHttpKernel] is not instantiable

报错

(1/1) BindingResolutionExceptionTarget [Illuminate\Contracts\Http\Kernel] is not instantiable.
in Container.php line 945
at Container->notInstantiable('Illuminate\\Contracts\\Http\\Kernel')in Container.php line 785
at Container->build('Illuminate\\Contracts\\Http\\Kernel')in Container.php line 658
at Container->resolve('Illuminate\\Contracts\\Http\\Kernel', array())in Container.php line 609
at Container->make('Illuminate\\Contracts\\Http\\Kernel', array())in Application.php line 260
at Application->make('Illuminate\\Contracts\\Http\\Kernel')in index.php line 52

检查public/index.php

laravel的:

<?php

/**
 * Laravel - A PHP Framework For Web Artisans
 *
 * @package  Laravel
 * @author   Taylor Otwell <taylor@laravel.com>
 */

define('LARAVEL_START', microtime(true));

/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader for
| our application. We just need to utilize it! We'll simply require it
| into the script here so that we don't have to worry about manual
| loading any of our classes later on. It feels great to relax.
|
*/

require __DIR__.'/../vendor/autoload.php';

/*
|--------------------------------------------------------------------------
| Turn On The Lights
|--------------------------------------------------------------------------
|
| We need to illuminate PHP development, so let us turn on the lights.
| This bootstraps the framework and gets it ready for use, then it
| will load up this application so that we can run it and send
| the responses back to the browser and delight our users.
|
*/

$app = require_once __DIR__.'/../bootstrap/app.php';

/*
|--------------------------------------------------------------------------
| Run The Application
|--------------------------------------------------------------------------
|
| Once we have the application, we can handle the incoming request
| through the kernel, and send the associated response back to
| the client's browser allowing them to enjoy the creative
| and wonderful application we have prepared for them.
|
*/

$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);

$response = $kernel->handle(
    $request = Illuminate\Http\Request::capture()
);

$response->send();

$kernel->terminate($request, $response);

是这一句放到lumen里面就错了

$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);

把lumen的index.php拷过来就行了

posted @ 2023-02-10 17:11  快乐的提千万  阅读(76)  评论(0编辑  收藏  举报