Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

rushikesh93's avatar

it is possible to upgrade only php version php 7.4 to php 8.1 without upgrade Laravel version?

Updated Question

I want to upgrade only the PHP version for my Laravel project,

My Laravel Framework version is 6.20.19 and PHP version is 7.4,

now I want to upgrade only php version php 7.4 to PHP 8.1 for my current Laravel project, how can I do without upgrading the Laravel version?

I have configured PHP 8.1 in my Linux System and configured my Laravel 6.20 version project, and made some changes in composer.json.

"require": { "php": "^8.1", "laravel/framework": "^6.0", "barryvdh/laravel-dompdf": "^0.8.5", "fideloper/proxy": "^4.4", "laravel/helpers": "^1.3", "laravel/socialite": "^5.2", "laravel/tinker": "^2.5", "razorpay/razorpay": "^2.5", "twilio/sdk": "^6.16", "vanilla/js-connect-php": "^4.0", "facade/flare-client-php": "^1.5", "symfony/http-foundation": "^5.4", "symfony/mime": "^6.2|^7.0", "symfony/mailer": "^v6.3.0", "swiftmailer/swiftmailer": "^6.0" }, "require-dev": { "facade/ignition": "^1.4", "fzaninotto/faker": "^v1.9.2", "laravel/ui": "^1.0", "mockery/mockery": "^1.4", "nunomaduro/collision": "^3.0", "phpunit/phpunit": "^9.5" },

now run "composer update --with-all-dependencies" Output

Loading composer repositories with package information Updating dependencies Your requirements could not be resolved to an installable set of packages.

Problem 1 - Root composer.json requires facade/flare-client-php ^1.5 -> satisfiable by facade/flare-client-php[1.5.0, ..., 1.10.0]. - facade/flare-client-php[1.5.0, ..., 1.10.0] require symfony/mime ^3.4|^4.0|^5.1 -> found symfony/mime[v4.3.0-BETA1, ..., 4.4.x-dev, v5.1.0-BETA1, ..., 5.4.x-dev] but it conflicts with your root composer.json require (^6.2|^7.0). Problem 2 - laravel/framework[v6.20.0, ..., 6.x-dev] require symfony/http-foundation ^4.3.4 -> found symfony/http-foundation[v4.3.4, ..., 4.4.x-dev] but it conflicts with your root composer.json require (^5.4). - laravel/framework[v6.0.0, ..., v6.19.1] require php ^7.2 -> your php version (8.1.21) does not satisfy that requirement. - Root composer.json requires laravel/framework ^6.0 -> satisfiable by laravel/framework[v6.0.0, ..., 6.x-dev].

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

0 likes
4 replies
rushikesh93's avatar

@hupp I have already changed the PHP version from PHP7.4 to PHP 8.1, but after the PHP version change and running the project, I get the above errors, these errors are displayed because the current Laravl version is not compatible with PHP8.2, but I don't want to upgrade my Laravel version and I want to Fix this error.

how can I do that? please guide me on this. Thanks.

hupp's avatar

@rushikesh93 That's would be impractical but still you want to do than you have to make change in its vendor core files. and use the new alternative functions and syntax as per php 8.1 But after that all fix you can't update any composer package, if you do it will may overwrite these changes and all errors came again

Snapey's avatar

You can't run laravel 6 on php 8.x

Please or to participate in this conversation.