How to prepare Magento 2.3 for 2.4 - Magento 2 Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
the magento 2.4 branch introduces new system requirements that you'll need to implement before you can upgrade from 2.3 so in this video i'll go over those requirements and how to set them up after this short message digital startup can now be found on twitch under the science and technology category this is where you'll find me streaming behind the scenes content such as informal discussions research for upcoming videos video editing and youtube preparation you'll also catch me learning javascript most weekends so if you enjoy informal behind-the-scenes content follow me on twitch.tv digital startup this video serves as a part two to my how to install magento 2.3 and build a web server tutorial from late 2018 which might make you ask the question hey craig why don't you do a video on upgrading 2.3 to 2.4 and it's a fair question with a simple answer new branches are buggy in nature for many others including myself it's a business risk upgrading to a new branch we don't want to be the guinea pigs that find and report new issues therefore we'll wait for the fixes to roll out before making the big switch some magento 2.4 system requirements are incompatible with magento 2.3 therefore we are limited to how far we can upgrade this means that upgrading from magento 2.3 to 2.4 would be quite a jarring experience in that you'd have to upgrade your system and your magento installation at the same time that's too many points of failure for my liking i'm crossing my fingers that the 2.3 branch will eventually support 2.4 system requirements so that i can break up the update over several small sessions as opposed to one big one we'll be upgrading parts of the operating system and the services that run on it this means that your typical magento backup is useless if you run into any system related issues if you have the ability to backup your operating system like i do with a digital ocean snapshot then use them you can never have enough backups you should try to get into the habit of running regular ubuntu updates and package upgrades so let's start here luckily this procedure can be broken down into three steps but the remainder or at least the most part this video i'll be running all the commands as the super user so let's first update our repositories with sudo apt update and then we want to upgrade any available packages and we'll use that by typing in sudo apt upgrade and then a dash y flag now the dash y flag simply also confirms yes to any are you sure questions um also to know that whilst you're doing this there's a possibility that you'll see a prompt come up asking you whether you want to install default configurations for certain applications i'm not sure if it's the correct answer or not but typically when i see them i will tell it yes install the manufacturer's version of those settings and then go from there this is going to take about a minute or two so what i'm going to do is skip ahead and i'll see you in just a second finally clean up any applications that are no longer dependent on with sudo apt remove uh key okay so it looks like i don't have anything to remove at this stage if you did it would take another minute or two whilst it cleared through that stuff okay so when i originally wrote this tutorial i included this step to upgrade ubuntu to version 20. however i did learn the hard way that doing this will also upgrade mysql from five to eight which is not compatible with magento 2.3 if you still want to upgrade ubuntu and go through the headache of downgrading mysql from eight to five then i'll include the command in the article otherwise simply skip this step i know i will so magenta 2.4 adds support for mysql8 and drop support for mysql 5.6 but it still supports mysql 5.7 and magento 2.3 supports mysql 5.7 but not mysql8 i know there's a lot of confusing numbers in there however this just means that mysql 7 is the only version of mysql that is compatible for both versions of magento what's good news though is that when we just did the update of ubuntu repositories and upgraded the packages we did in fact also upgrade magenta mysql sorry to 5.7 and we can verify that by typing in mysql space dash capital v and as you can see the distribution version is 5.7.32 so nothing more to be done there thankfully upgrading magento within the same branch is very simple compared to changing branches completely because some fixes and changes get shared between the 2.3 and 2.4 versions at the same time there will be less changes to adapt to when you're ready to make the big jump later next year for now i'll be updating magento 2.3.5 p2 to 2.3.6 which is the current version at the time of creating this video uh first things first we need to switch the magento user so let's do that by typing su magento which is the name of my magento user and let me throw in the password and then let's switch to the magento directory which is cd space slash var www slash html and then these next steps are on you won't necessarily find these steps in this particular order if you're googling something similar these steps that i've done which i believe there's about 12 steps are the steps that i've fine-tuned over the years to make sure that things run smoothly with any without any caching issues so let's start with step one which is enabling maintenance mode i'm not going to read out all the commands because you can copy and paste those from the article i'm just going to put them in and tell you what the steps are so enabling maintenance mode which will stop any customers from being able to interact with the site whilst we're doing all of this and then we're going to tell composer to um use the 2.3.6 package and that'll take a few seconds there okay and next we're going to do a composer update so we'll let that run through in fact this normally takes a couple of minutes so what i'm going to do i'm going to skip through on the video and i'll see you in just a second okay so that's about five minutes what i normally find with the compose update command is that when you initially put the command in um it makes you think that the whole system is hanging but it just takes like a minute or two to get going and then you'll see all this stuff slide across the screen okay so let's manually clear some of the caching folders and then we will flush redis if you have it installed and then we're going to do a um upgrade of the magento database schema and again that's going to take a minute or two so i'm just going to skip forward on that one and then we're going to compile everything and again i'll skip ahead on this one and then i'm going to redeploy static contents just be sure to change your locales so my setup i use two locales en underscore us and en underscore gb so rather than just copy paste that off the article um just substitute those locales with whatever's applicable to you anyway i'm going to skip forward on this bit as well then i'm going to clean the cache then i'm going to flush the cache and then what i'll do is flush redis once more and then re-enable or sorry disable uh maintenance mode now obviously if you're using varnish you want to flush varnish as well but i don't typically typically use varnish these days so that's not something that i do okay so next i want to talk about php um normally before i would do something like this i would start off by updating php um however um doing this tutorial i ran into a few issues i don't know whether they were specific to 2.3.5 but when i tried to do this if i updated php first and then tried to update magento from 235-236 i would run into compatibility issues with php even though officially php 7.3 is supported so for this tutorial and just to keep things nice and smooth and going along quite quickly i put the php of grade step after the magento upgrade step so let's do that bit now so as a reminder the magento 2.3 branch does not support php 7.4 which is a shame so if you're still running php 7.2 then let's at least get you on to 7.3 so for your convenience you can copy and paste the install for php 7.3 from the article or which i'm pasting in here and i'm going to hit enter and let me actually know i should say first of all let's back out by typing in exit because we need to be the super user for this next bit so let me just clear the screen by typing clear and we can start afresh so let's put in our php 7.3 command followed by our supervisor password and it looks like at some point i already went ahead and installed php 7.3 so when you install a new version of php you also need to update the configuration file for that particular version of php um so if you remember from the videos we've done in the past whenever we install php we need to set up two variables so first let's edit the file and we need to search for the time zone configuration and let's remove the comment at the beginning and for me it's europe if i can spell it slash london that looks good and then we need some memory limits and let me do that again memory underscore limits there it is and i'm going to change that to 2 gig there we go and control w to exit y to save and enter to confirm oops let's try again draw x yes enter there we go um now we need to disable php 7.2 so we do that by typing sudo space a2 disk mod space php 7.2 and then we need to enable php 7.3 which is pseudospace a2 n mod space hp 7.3 and then for those changes to take effect we need to restart apache by typing in sudo space system ctl space restart space apache 2 now i know something's going to happen now and i left in here on purpose when i was doing my other videos because the same thing might happen to you so let's cover it now so in theory i should be running 7.3 right now when i type in php space-v to get my version and what you'll find is that i'm still running php 7.2 even though i disable php 7.2 and enable php 7.3 3. well if you run into the same situation i have a nice command you can copy and paste from the article and that is sudo space update dash alternative space double dash config space php and here you'll notice that i've got options to flick between php versions so the top one num zero is auto mode so if you have this option set to auto mode it'll always select the latest version of php that you have installed or you can flick between different versions of php by selecting the selection on the left so right now you can see i've got number two selected which is for 7.2 but i want to enforce 7.3 and i already have a php 7.4 installed so let's choose option three now if i restart apache one more time for my changes to take effect and i type in php space dash v you'll see now that we're on php 7.3.24 now this next bit is optional if you want to get rid of php 7.2 after you've switched over you can type in the following commands however if you are still testing and you want to keep flicking between 7.2 and 7.3 and obviously leave seven point three on there but i like to try and do housekeeping where i can so i'll be removing it so that's sudo space app space purge space php 7.2 dash common space dash y and that should remove everything for me now and that might take a minute so i'm going to quickly skip ahead and there we are good to go so if you've not yet installed elasticsearch 7.6 on your web server you'll need to do that before upgrading to magento 2.4 as well i've covered this twice now in previous videos so rather than go over a third time if you just click the link in the article it will take you to one of the elastic search tutorials where you can follow that along okay finally you want to upgrade any third-party modules you have installed so they are compatible with the new environments for example you might have a cool module that you use at the checkout which doesn't work with a php 7.4 if your module has been built by a reputable company then the latest version of that module would support magento 2.4 so it's really important that you upgrade it so that it becomes compatible if you don't do that then it will stop magento being able to be upgraded because it will say this module depends on an old version of php therefore it won't let you upgrade it however if you've built the module yourself or it's no longer supported by the company you obtained it from then you'll need to find a suitable replacement these are the kind of things that will cause you a headache when it comes to crunch time so it's get best that you get ahead of it now so to reiterate there's currently no way to fully prepare our system for a seamless upgrade experience all we can do right now is meet the process halfway and hope that magento will include support to fully upgrade php 7.4 and mysql8 whilst it's still within the 2.3 branch albeit it's probably unlikely okay hopefully you found some of this useful in some way and until next time take care
Info
Channel: Digital Startup
Views: 2,234
Rating: undefined out of 5
Keywords: magento, starting an online store, build a magento store, how to, tutorial, ecommerce, web development, digitalstartup, magento 2 beginner tutorial, magento 2
Id: MIwYfUCW0RM
Channel Id: undefined
Length: 15min 0sec (900 seconds)
Published: Thu Nov 12 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.