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.
Related
We have a web server with Ubuntu 12.04. we are running a drupal website in this server and we used PHP 5.3 on this server.
As part of server migration, I am planning to up a new Ubuntu 16.04 server with latest PHP 7.2, After migrating above specified Drupal application into it, We are getting a white screen when we try to access this site.Our developer says that it is because of some of the drupal core functionality is not working with new PHP 7.2, because some of the functionality that used D6 is deprecated in Latest PHP. So we need a Drupal version upgrade to 8. System upgrade to D6 will require more work. So can anyone suggest any alternative options other than Drupal version upgrade.
Also we are using php memcached in old server, PHP 7.2 is not provided memcached
Even Drupal 7 has issues with PHP 7. The core should work, but lot of 3rd party modules won't and I wouldn't recommend running Drupal 7 site on PHP 7.
For Drupal 6 situation is most likely even worse so if you don't want to end up patching manually large number of modules and D6 core I would advise you not to do this. Try to provide older PHP version or this can easy become never ending nightmare.
I am facing a problem with my hosting server where php 5.6 has been installed which can't be upgrade to php 7. But my project has been completed in laravel 5.5 which need php 7 to run. Is there any solution to switch laravel 5.5 to laravel 5.4
In fact there is no easy way to do that. If application is using Laravel 5.5 features some parts of it won't work and you might waste a lot of time to finding and fixing those issues.
In my opinion much cheaper way would be changing hosting and in fact it would me more reasonable to use PHP 7.x than 5.6 in 2017/2018. If you look at PHP versions you will see, that for 5.6 only security fixes are applied at the moment
I recently upgrade a site from PHP 5.3 to PHP 7. I can edit pages in the admin, but when I click update, it never finishes, but the changes show up on the page itself. This problem doesn't happen if I revert to 5.3. The memory limit is set to 128M, so I have no clue what could be causing this, other than the upgrade from 5.3 to 7. Did something change between the two versions of PHP that could cause this?
Did something change between the two versions of PHP that could cause this?
Short answer: Yes it did.
The changes between PHP 5.3 and 7.0 are huge, including a lot of backward compatibility breaks.
I suggest reading the PHP manual where they discuss these issues for each version:
PHP 5.4 BC breaks
PHP 5.5 BC breaks
PHP 5.6 BC breaks
PHP 7.0 BC breaks
If you're doing this upgrade, you need to make certain that the software you're running (ie Wordpress and all the plugins and templates that you've installed) will work in PHP 7.
You would be well advised to take the upgrade in steps. Most of the breaking changes were between 5.3->5.4 and 5.6->7.0, so maybe try upgrading to 5.5 or 5.6 first before attempting the jump to 7.0.
You may also find that with the size of the version jump you're attempting, you might be forced into a staged upgrade anyway -- if you're running older versions of Wordpress and your plugins, there might be intermediate upgrades that you have to make to them as well before you can get to a version that works in PHP 7.
Finally, you may decide to only take your upgrade to 5.6 for the time being, as it will be a lot less challenging. You can complete the move to 7.0 later. This is because the update 5.3 to 5.4 or 5.5 or 5.6 should be fairly safe, as the breaking changes in 5.3->5.4 were a long time ago now and any developer keeping up with the times will have had plenty of time to dealt with them by now. However 7.0 is a much more recent release, so not all code has been updated to work with it yet.
The lesson to learn here is to keep up with version changes as they happen, rather than waiting for years to do a single big-bang upgrade.
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.
We have a requirement for upgrading the PHP version (5.3.25) to current stable version which is 5.6.17. So, for this we need to find which approach would be best.
Step by step approach, in which we can upgrade from 5.3.X to 5.4.X, 5.4.X to 5.5.X and so on.
Direct upgrade, in this we will directly upgrade from 5.3.X to 5.6.X.
Apart from the upgrade, what all things we should keep in mind while doing this.
It would be good, if any of you have any documents which we can refer to.
PHP maintainers upload list of incompatible changes of every release. Here are the documents you may want to read:
5.4 incompatible changes
5.5 incompatible changes
5.6 incompatible changes
If you have regression tests, you're the lucky man; if you don't, i strongly recommend test every change in virtual environment before real environment update on main server. If you're brave enough, you can try to setup vagrant - this will allow developers to easily share their environment and to reproduce server state as it should be after upgrade to 5.6.
I also wouldn't recommend partial upgrades, i think it's better to target for 5.6 at the first (and only) migration step.
On my experience, we upgraded our PHP version from 5.3.28 to 5.6.6 directly because of server upgrades, and one more reason is you can easily check all your modules faster if there's an error rather than checking it on every version.
What you should keep in mind:
deprecated functions
if you're using PHP frameworks (CodeIgniter, Laravel, etc.), consider upgrading them too
current code implementations