I’m trying to install an older version of laravel it gives me [InvalidArgumentException] Could not find package laravel/laravel with version 5.8.* in a version installable using your PHP version, PHP extensions and Composer version.
This is my PHP version
$ php –version
PHP 8.0.0 (cli) (built: Nov 24 2020 22:02:57) ( ZTS Visual C++ 2019 x64 ) Copyright (c) The PHP Group Zend Engine v4.0.0-dev, Copyright (c) Zend Technologies
I used this command to install laravel
$ composer create-project --prefer-dist laravel/laravel blog "5.8.*"
I removed the composer installation and reinstall it again it always gives the same error. Any help?
Thanks in advance
2
Answers
You cannot run Laravel 5.8 on PHP 8.0. Laravel 5.8 requires PHP ^7.1.3.
The only version fully supporting PHP 8.0 to date is Laravel 8.x.
Furthermore, I strongly advise not to use an old Laravel version like that, as it is not actively maintained anymore. Fortunately, upgrading an existing Laravel 5.8 project to Laravel 6 is fairly simple, just head over to https://laravel.com/docs/6.x/upgrade and work your way through the upgrade guide.
Laravel 6 is a LTS version and will receive bug fixes until September 7th, 2021 and security fixes until September 6th, 2022.
Upgrading Laravel 6 to 7 and 7 to 8 is even less of an issue than the 5.8 -> 6 update, so you might want to keep going until you are up to date and can stick with PHP 8.0.
Laravel 5.8 dosent work with PHP 8, downgrade your PHP Version to 7.4 and it should work