laravel 旧版本不支持 php 8.0.8
Posted
技术标签:
【中文标题】laravel 旧版本不支持 php 8.0.8【英文标题】:laravel old version is not supporting php 8.0.8 【发布时间】:2021-11-10 04:38:17 【问题描述】:我在本地计算机上安装了 php 8.0.8。 Laravel 新项目完美运行。但是当我尝试运行旧项目时,它会显示错误。当我尝试运行命令时
composer install
它给了我以下错误:
Problem 1
- jeremy-dunn/php-fedex-api-wrapper is locked to version 5.0.1 and an update of this package was not requested.
- jeremy-dunn/php-fedex-api-wrapper 5.0.1 requires ext-soap * -> it is missing from your system. Install or enable PHP's soap extension.
To enable extensions, verify that they are enabled in your .ini files:
- C:\xampp\php\php.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
当我跑步时:
composer dump-autoload
它显示了这个错误:
Generating optimized autoload files Class App\Http\Controllers\Vendor\OrderController
located in C:/Users/Muhammad Adnan/Downloads/test-upwork-master/spree-retail/app\Http\Controllers\temp\OrderController.php does not comply with psr-4 autoloading standard. Skipping.
Class App\Http\Resources\profile\AddressesResponse located in C:/Users/Muhammad Adnan/Downloads/test-upwork-master/spree-retail/app\Http\Resources\Profile\AddressesResponse.php does not comply with psr-4 autoloading standard. Skipping.
Class Illuminate\Foundation\ComposerScripts is not autoloadable, can not call post-autoload-dump script
> @php artisan package:discover --ansi
Fatal error: Uncaught Error: Class "Illuminate\Foundation\Application" not found in C:\Users\Muhammad Adnan\Downloads\test-upwork-master\spree-retail\bootstrap\app.php:14
Stack trace:
#0 C:\Users\Muhammad Adnan\Downloads\test-upwork-master\spree-retail\artisan(20): require_once()
#1 main
thrown in C:\Users\Muhammad Adnan\Downloads\test-upwork-master\spree-retail\bootstrap\app.php on line 14
PHP Fatal error: Uncaught Error: Class "Illuminate\Foundation\Application" not found in C:\Users\Muhammad Adnan\Downloads\test-upwork-master\spree-retail\bootstrap\app.php:14
Stack trace:
#0 C:\Users\Muhammad Adnan\Downloads\test-upwork-master\spree-retail\artisan(20): require_once()
#1 main
thrown in C:\Users\Muhammad Adnan\Downloads\test-upwork-master\spree-retail\bootstrap\app.php on line 14
Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 255
【问题讨论】:
你不应该在 PHP 8 上安装旧版本。某些功能将无法使用。这就是你无法安装版本的原因 【参考方案1】:不幸的是,旧版本的 Laravel 不支持新版本的 PHP。 Laravel 6 是支持 PHP 8.0 的最低版本(从 Web 开发的角度来看,它已经相当老了)。
当然,这是全新安装,您的项目中的代码可能也不兼容 PHP 8.0。
关于这个错误:
Problem 1
- jeremy-dunn/php-fedex-api-wrapper is locked to version 5.0.1 and an update of this package was not requested.
- jeremy-dunn/php-fedex-api-wrapper 5.0.1 requires ext-soap * -> it is missing from your system. Install or enable PHP's soap extension.
问题很容易解决,只需安装soap扩展。您似乎在 Windows 上,所以它应该已经安装但已禁用。
您必须在您的php.ini
文件中取消注释;extension=soap.dll
(或者可能在位于您的php 目录中的ext
目录中,这取决于)。
可能需要其他扩展但已禁用,以获取完整列表执行composer check
。
这是阻止 composer 安装您的依赖项的原因(当您调用 composer dump-autoload
时会导致 Uncaught Error: Class "Illuminate\Foundation\Application" not found in
)。
【讨论】:
【参考方案2】:我搜索并找到了有关此问题的解决方案。只有一个命令是解决方案 注意:不要更新作曲家。
composer install --ignore-platform-reqs
【讨论】:
永远不要安装忽略平台要求。无法在 PHP 8 上安装旧版本是有原因的以上是关于laravel 旧版本不支持 php 8.0.8的主要内容,如果未能解决你的问题,请参考以下文章
php 7.4.2 版本的 laravel 6.2 不支持 ajax 调用 post 方法中的错误