请教 php artisan migrate报错 如何处理
1. 运行环境
1). 当前使用的 Laravel 版本?
Laravel 5.5.50
2). 当前使用的 php/php-fpm 版本?
PHP 版本:PHP 8.1.2 (cli)
php-fpm 版本:
3). 当前系统
Linux version 5.15.0-47-generic (buildd@lcy02-amd64-060) (gcc (Ubuntu 11.2.0-19ubuntu1) 11.2.0, GNU ld (GNU Binutils for Ubuntu) 2.38)
4). 业务环境
5). 相关软件版本
2. 问题描述?
user@IsomirWindow:~/Downloads/IsomiR_Window_Built/opt/lampp/htdocs/isomirwindow$ php artisan migrate
PHP Warning: Undefined property: ReflectionNamedType::$name in /home/user/Downloads/IsomiR_Window_Built/opt/lampp/htdocs/isomirwindow/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 885
PHP Fatal error: Uncaught ReflectionException: Class “” does not exist in /home/user/Downloads/IsomiR_Window_Built/opt/lampp/htdocs/isomirwindow/vendor/laravel/framework/src/Illuminate/Container/Container.php:752
public function build($concrete)
{
// If the concrete type is actually a Closure, we will just execute it and
// hand back the results of the functions, which allows functions to be
// used as resolvers for more fine-tuned resolution of these objects.
if ($concrete instanceof Closure) {
return $concrete($this, $this->getLastParameterOverride());
}
$reflector = new ReflectionClass($concrete); //line752
// If the type is not instantiable, the developer is attempting to resolve
// an abstract type such as an Interface of Abstract Class and there is
// no binding registered for the abstractions so we need to bail out.
if (! $reflector->isInstantiable()) {
return $this->notInstantiable($concrete);
}
$this->buildStack[] = $concrete;
$constructor = $reflector->getConstructor();
// If there are no constructors, that means there are no dependencies then
// we can just resolve the instances of the objects right away, without
// resolving any other types or dependencies out of these containers.
if (is_null($constructor)) {
array_pop($this->buildStack);
return new $concrete;
}
php换7.3试试
额,你程序应该都跑不起来吧,Laravel 5.5.50 用 PHP 8.1
laravel 版本太低了,要么升 laravel 版本, 要么降低 php 版本
操作前务必备份
vendor
composer.json
composer.lock
,有些扩展更新了可能系统不兼容,需要自己逐一去处理,理论来讲不会太多的。