Getting error while updating laravel from 5.5 to 5.7 (Undefined class constant 'HEADER_CLIENT_IP')

旧街凉风 提交于 2019-12-06 07:56:22

At composer.json Change fideloper/proxy

From

"fideloper/proxy": "~3.3",

To

"fideloper/proxy": "^4.0",

After that run

composer update

1) change your composer.json to following

"php": ">=7.1.3",
"fideloper/proxy": "^4.0",
"laravel/framework": "5.7.*",
"laravel/tinker": "~1.0",

2) change your App\Http\Middleware\TrustProxies.php to following

<?php

namespace App\Http\Middleware;

use Illuminate\Http\Request;
use Fideloper\Proxy\TrustProxies as Middleware;

class TrustProxies extends Middleware
{
    /**
     * The trusted proxies for this application.
     *
     * @var array|string
     */
    protected $proxies;
    /**
     * The headers that should be used to detect proxies.
     *
     * @var int
     */
    protected $headers = Request::HEADER_X_FORWARDED_ALL;
}

3) remove the file from the config directory having name trustedproxy.php if exist

4) run the following command into the console from your application directory

composer update

5) this step is not necessary but it will clear all cache and autoload files

php artisan clear-compiled

composer dump-autoload

php artisan cache:clear

php artisan config:clear

php artisan view:clear

Did you try to update the composer

composer update

and dump the autoload ?

composer dump-autoload
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!