Upgrade Laravel from 5.2.45 to 7.0 - php

I inherited a Laravel app that works fine but it's really old version (5.2.45).
What's the best way to upgrade this to something supportable? This Laravel version is incompatible with PHP 7.3 so I am stuck using an old PHP 7.0 version that is deprecated and a security risk.
Is Laravel 7.0 my best bet or should I upgrade to a different version?
PS: I'm noob on PHP, so please be as detailed as possible.

To answer my own question, I have to upgrade gradually from 5.2 > 5.3 > ... > 7 and fix all incompatibilities manually. Laravel shift can help but it won't fix everything and on every iteration there is work involved.

Related

Steps for upgrading Laravel and PHP

I have a Laravel application that has been running since mid 2018. PHP is currently version 7.2.5 and Laravel is 5.6.22. I need to upgrade PHP to either 7.4 or 8.0, and Laravel to either 6 LTS, or 8.
As far as I can see, I have two options:
Upgrade PHP to the new version, then incrementally upgrade Laravel from 5.6.22 to 6 LTS (or 8), testing each version as I go; or
Upgrade both PHP and Laravel to their new versions, and do one round of testing
My initial thought was to use method 1, reading the Laravel notes for each release and tailoring my testing efforts as I go. But upon upgrading PHP to 7.4, Laravel started to fail somewhere deep in the library, so I guess V 5.6.22 does not work with PHP 7.4
Is there a standard approach to this problem? (Note that, sadly, I don't have automated unit tests).
This happened to me when I started working with Laravel, I started with Laravel 5.3 and my team had to upgrade it to 5.4, 5.5, 5.6 and 5.7 (then I left haha).
What we ended up doing was:
First upgrade PHP, as it is the mostly certain that it will not cause any issue. I recommend you to upgrade to 8.0
What we had done to upgrade was having tests. Previously we did not have, so we learn how to test and we reach a coverage of 90%, so we were extremely good at it and advancing fast on it.
Once you have the tests, you can start migrating version by version. Because you are on 5.6, you could directly upgrade to 6 or 8, so you can follow the guide to upgrade from 5.8 to 6 or 7 to 8. It is easy to upgrade, the important stuff is related to packages mostly.
These are the tips and personal experience I can share with you. It is 100% important to have tests, else it will be a pain for you as you will not be 100% sure if something broke.

How to downgrade PHP 5.6 to PHP 5.3?

Do you know how to downgrade php from 5.6 to 5.3?
I created a website with PHP 5.6 but when my client uploaded on their server some functions on my website are not compatible and they say that the problem is because their PHP version is 5.3 and I don't know about it, so they want me to downgrade my PHP version. Can you help me?
Or any solution to my problem? So, my website can be compatible on their server.
You're most likely talking not about downgrading of the PHP executables, but about downgrading language level from 5.6 to 5.3
There is no automatic way to do it, but you can study syntax changes between versions (information can be found into official manual) and update your code accordingly.
Also it may be good idea to remind customer that PHP 5.3 is not supported anymore so it may be good idea to upgrade PHP version instead of downgrading site. 5.3 -> 5.6 upgrade is relatively plainless.

Will Laravel work on php 5.3.3 server

good day! Just a quick question about laravel since we are planning to use laravel on our new project, the problem is the client is using php 5.3.3 on their server. I know that laravel works on php 7 but the question is will it still work on php 5.3.3? Thank you in advance.
Looking at the oldest version available in the documentation located at https://laravel.com/docs/4.2/#server-requirements
It states
PHP >= 5.4
So I would say No.
This is due to found security risks in various versions of PHP so Laravel has a baseline for PHP.
If you can use Docker, you can use a PHP7 Docker container with the latest stable version of Laravel, and then you will not touch the PHP 5.3 version

Upgrading PHP version on Parallels Ubuntu

Recently, I require to upgrade PHP version from 5.3.3 to higher. Can any one tell me which version of PHP I should upgrade for? Which one is more stable? PHP 5.4 or 5.5 or 5.6?
The latest stable version is PHP 5.6.11
According to the release history, 5.4 is only getting security updates and 5.5 will stop getting bug fixes in 10 months. So 5.6 is your best bet. Considering there are only minor syntax changes between these versions, you should go for the latest anyway.
The 5.3 to 5.4 gap may require some alterations in your code. And if your code works on 5.4, it will also work on 5.6, so just use the latest.

Is it safe to upgrade from PHP 5.3.3 to PHP 5.5 in CentOS 6.6?

I need to install a plugin on my website which requires PHP >= 5.5. Right now i'm running PHP 5.3.3 on CentOS 6.6.
Is it safe tou upgrade PHP or there is a a tangible risk that some
applications won't work after upgrade?
Is there a way to "rollback" the upgrade? So that i upgrade, i check that everything works and, if not, i downgrade.
Thanks!
Yes, there is a chance that some applications won't work. I upgraded from 5.3 to 5.4 on a system and found that a bug appeared in production code. It wasn't anything that couldn't be fixed. Of course, there have been other times where an upgrade worked flawlessly.
If you install 5.5 on the system without disturbing the 5.3 installation then it should be possible to rollback to 5.3 if needed. Just save the server configuration for 5.3 before pointing it to 5.5.

Categories