I have project developed in Laravel 5.2 version. But now I want to upgrade only PHP version to 7.3 So can anyone let me know that if Laravel 5.2 works with PHP latest versions.
I want laravel version to be unchanged but with latest PHP version that is PHP 7.2+
It is highly recommend to upgrade your Laravel version in this case as Laravel 5.2 supports PHP version between 5.5.9 - 7.1.* as per documentation but if you have concerns you can tweak the php version to 7.2 and test if its works.
To change the php version just add below code to your composer.json file.
"config": {
"platform": {
"php": "7.2"
}
}
after that run composer update if you get any error you can always revert it back by tweaking the version again in composer.json file
Related
So.. I developed a project with Laravel 9, then I had to upload it to my client's server by FTP ( which was slow and painful ) to find out only afterwards that my client's server PHP version could not go over 8.0. I tried to open the project live link ( to where I uploaded ) and the composer platform check was telling me my project had dependencies on PHP 8.1 and that my version is 8.0.
So I tried tweaking the platform check php file to disable this check, to see if it would work anyways but no, the project was throwing errors.
So I decided to downgrade to laravel 8, because after searching around I read that laravel 8 did not need php 8.1.
I guess I read some wrong information because after tweaking my project to downgrade to laravel 8 and uploading again (painfully by ftp), the platform check was again telling me that my project needed PHP 8.1.
So I disabled again this platform check by editing/tweaking the platform check php file, to see if it would work anyway, and it did work. So all good. but then today I was learning how to check which composer packages had dependencies on a specific php version, and in the process I found out (if I'm not wrong) that laravel 8 has package dependencies that depend on PHP 8.1 ?
Is there a table somewhere I can check which Laravel versions depend on which PHP versions or do I have to run some commands on each project to check these dependencies?
Like in the images below:
Thanks !
Laravel 9 does not require PHP 8.1 it requires PHP 8.0.2
If this a shared project and someone else with PHP 8.1 generated the composer.lock file (or indeed you locally have PHP 8.1 but the server has 8.0) you might end up with packages that require PHP 8.1. Composer resolves and installs packages based on the locally installed PHP version.
You can override this behaviour and ensure everyone gets package deps based on the PHP version you expect to have on production if you use the platform config option in your composer.json e.g. add this to your composer.json
"config": {
"platform": {
"php": "8.0.2"
}
}
Then run
composer update
this should try to fix your package versions to ones that work with PHP 8
Short response no, Laravel 8 requires PHP >= 7.3
From Server Requirements
But, since you downgraded it is possible that some php packages require newer php versions no matter the version chosen for Laravel.
Some hints:
Change dependencies (packages) version, probably downgrade them.
Delete the vendor folder.
Delete composer.lock
Run composer install
Checking your screenshot: with symfony the downgrade will not break anything.
But, check the other package/s ie: tojsverkoyen/css-to-inline-styles requirements.
I have changed php version to 7.1.3 and also Laravel version in composer.json file. Then simply use composer update but nothing happens. I need help.
PHP 7.1 will no longer be actively maintained as of December 2019. Therefore, Laravel 6.0 requires PHP 7.2 or greater.just follow the documentation https://laravel.com/docs/6.x/upgrade
I am trying to install "spatie/laravel-activitylog" in Laravel install using command composer require spatie/laravel-activitylog
But I am getting the error that says
Don't install Laravel 5.3
But I don't want to update the Laravel version.
I think If I try to install an older version of "spatie/laravel-activitylog". It won't have any compatibility issues with Laravel 5.3.
But I don't know which older version of this package will be best for Laravel 5.3.
The latest version requires Laravel 5.5. That is why you get the error. To use spatie/laravel-activitylog you need to upgrade Laravel or download an earlier version.
If you look at the requirements for version 1 here: https://docs.spatie.be/laravel-activitylog/v1/requirements you find that:
The activitylog package requires PHP 7.0+ and Laravel 5.2 or higher.
This is sufficient with your need so you can install this version by specifying it like this:
composer require spatie/laravel-activitylog "^1.0"
I've been having issues with my webapp ever since heroku upgraded to PHP 7.2.0. How can I downgrade to a 7.0.* version of PHP on heroku?
Heroku currently supports PHP 5.6, 7.0, 7.1 and 7.2.
You can select your runtime in your composer.json file, e.g.
{
"require": {
"php": "^7.0"
}
}
to select the latest version of PHP 7.0.
A little gotcha, make sure you commit in the composer.lock file after setting the php version in your composer.json:
composer update
I'd like to use Laravel 5.4 on my production server but the latest PHP 5.6 version available is 5.6.30 (as my local XAMPP installation as well), while the requirements for Laravel 5.4 are php >= 5.6.40 as for https://packagist.org/packages/laravel/laravel
Now, I've successfully installed Laravel 5.4 on the server in a subdirectory via SSH and the home page is showing the Laravel logo. Is there some problems I could encounter using this version of PHP down the road? If so, is there any polyfill or adjustment to be made in order to use Laravel 5.4 on PHP 5.6.30 instead of PHP 5.6.40? Thanks
Laravel require php 5.6.4 as you can see here
and XAMPP is 5.6.30 - This version is NEWER than 5.6.4 ( see all php versions here )
So no problems are expected becase you are using newer version than required by Laravel.
composer create-project --prefer-dist laravel/laravel (project name) 5.4.*
that will install the latest version of laravel supported by php 5.6
see in the attachment above
composer create-project --prefer-dist laravel/laravel (project name) 5.4.*
Laravel 5.4 is compatible with PHP 7.x. Please check the following article.
https://murze.be/2016/01/why-we-are-requiring-php-7-for-our-new-packages/