Upgrading PHP and MySQL through WHM

gen3

Registered
Dec 5, 2013
3
0
1
cPanel Access Level
Reseller Owner
Hi there,

Not sure if this is the right place to post this, but here goes.

Through WHM, I'm planning to upgrade PHP from version 5.3.10 to 5.4.22, and MySQL from version 5.0.96 to 5.5.

I'd like to upgrade overnight, when less customers would be online. However, through my research I haven't been able to determine how long the upgrades will take (so I'm not sure how to time it properly). I know the time to upgrade is based on the size of the databases - if it helps, the largest site on the account has a Disk Space Usage of 17 GB, and a database backup (.sql.gz) that is 5.5 MB. The rest of the sites are all relatively small. How much time should I allot for the upgrades?

Also, I'm planning to go through WHM to do the upgrades. Hopefully my approach is correct (?). This is what I'm thinking:
For PHP, I'm planning to go to Software > EasyApache and follow the prompts to upgrade.
For the MySQL upgrade: Software > MySQL Upgrade > Unattended Upgrade (using saved settings)
Does this sound reasonable?

Also, I've already done individual site backups in cPanel in preparation. Should I do some sort of overall backup in WHM before proceeding with the upgrades?

Sorry for all the questions - any help would be much appreciated. Thanks!
 

mtindor

Well-Known Member
Sep 14, 2004
1,463
114
193
inside a catfish
cPanel Access Level
Root Administrator
Hi there,

Not sure if this is the right place to post this, but here goes.

Through WHM, I'm planning to upgrade PHP from version 5.3.10 to 5.4.22, and MySQL from version 5.0.96 to 5.5.

I'd like to upgrade overnight, when less customers would be online. However, through my research I haven't been able to determine how long the upgrades will take (so I'm not sure how to time it properly). I know the time to upgrade is based on the size of the databases - if it helps, the largest site on the account has a Disk Space Usage of 17 GB, and a database backup (.sql.gz) that is 5.5 MB. The rest of the sites are all relatively small. How much time should I allot for the upgrades?

Also, I'm planning to go through WHM to do the upgrades. Hopefully my approach is correct (?). This is what I'm thinking:
For PHP, I'm planning to go to Software > EasyApache and follow the prompts to upgrade.
For the MySQL upgrade: Software > MySQL Upgrade > Unattended Upgrade (using saved settings)
Does this sound reasonable?

Also, I've already done individual site backups in cPanel in preparation. Should I do some sort of overall backup in WHM before proceeding with the upgrades?

Sorry for all the questions - any help would be much appreciated. Thanks!
Here are my particular thoughts.

1. Always back up the databases before a MySQL upgrade
2. Don't try to upgrade from 5.0 to 5.5 without first upgrading to 5.1

5.0 --> 5.1 --> 5.5

If you chose the option in WHM to upgrade MySQL, it might be smart enough to do it in stages. I can't remember. But if it isn't, there is more potential risk involved if you upgrade from 5.0 --> 5.5 by skipping 5.1. I think WHM/cPanel is smart enough to do this in stages, but I've never had to update above one release at a time.

After you perform a MySQL upgrade via WHM, it will automatically [depending upon your selection] go into EasyApache after the MySQL upgrade is complete and will push you into EasyApache to finish up.

Now, which one first? I dont think it matters. But, I would recommend (a) upgrade from MySQL 5.0 to MySQL 5.1 and then go through EasyApache and use the same profile / compile the same options [e.g. php 5.3.x]. Then, when that is finsihed and everything is working fine, upgrade from MySQL 5.1 to 5.5 -- and when you get to EasyApache compile the same options [e.g. PHP 5.3.x]. So basically I'm saying that you should get MySQL out of the way first -- and once it's up to date and your sites are working, then and only then go back and run EasyApache to upgrade to PHP 5.4.

I personally think that is your safest bet. It will take the longest [EA compiles aren't for the impatient]. But that way you dont find yourself having to troubleshoot both MySQL failures and issues that crop up because of scripts not being compatible with PHP 5.4.

Now, if the MySQL upgrade via WHM will allow you to upgrade from 5.0 to 5.5 and IF it will do that as a two-stage thing (5.0 -> 5.1, then 5.1 -> 5.5), I would still then recompile your existing EA setup rather than moving to PHP 5.4 as part of the same process. Again, it takes longer, but I think it's safer.

Again, you should back up databases beforehand. There are some instructions on thecpaneladmin.com for backing up all of your databases [but the example needs edited to actually work properly]. You can back up or not. I've never had a single problem during one of my MySQL updates, but if there is a problem you certainly want to have a recent good copy of SQL data to restore.

Oh -- and apparently I don't qualify as a server admin, so take my words with a grain of salt :)

Mike
 

gen3

Registered
Dec 5, 2013
3
0
1
cPanel Access Level
Reseller Owner
Hi Mike, thanks for the reply!

That makes sense. Based on my research, it seems you can go straight from MySQL 5.0 to 5.5, and WHM will go through all the intermediate stages ( http://forums.cpanel.net/f354/updating-mysql-5-0-5-5-a-262611.html ). So assuming that's the case, I would upgrade MySQL first (going to v5.5) and compile the same options (with the old version of PHP)... and THEN go into EasyApache and upgrade PHP to v5.4 (after I'm sure everything is working from the MySQL upgrade)?

Also, as far as time goes - I know you can't tell me exactly as it depends on the site, but are we talking more like 10 minutes or 10 hours for the upgrades? It's just that I want to start it late enough at night that very few customers are online... but I also don't want to be up until dawn waiting for it to complete / to troubleshoot!

Again, thanks a lot for your help - greatly appreciated! :)
 

mtindor

Well-Known Member
Sep 14, 2004
1,463
114
193
inside a catfish
cPanel Access Level
Root Administrator
Well, the MySQL upgrade (at least one stage) typically takes my machine a minute or so to complete -- it is pretty quick. I'm referring to the actual time after it downloads all the RPMs and does a bunch of prechecking. The "downtime" from each step of the MySQl upgrade is typically minimal. i would so no more than a couple of minutes each stage.

However, it's the EA compile that gets ya. Immediately after the MySQL upgrade, you'll find that the PHP sites won't be able talk with MySQL due to incompatible MySQL version support in your already-installed PHP. So you want to get through the EA process as quick as possible. That's another reason to choose the existing profile -- it'll get you through the process the fastest. And of course that EA process is different on just about every machine as far as hte time it takes. You could probably count on being down 15-30 minutes depending upon the options you have selected, for that first re-compile after the MySQL upgrade.

Then, after that, when MySQL 5.5 is running and your PHP 5.3 setup has been recompiled and all of your sites are working, you go to the next stage [your PHP 5.4 compile]. The only time you'll be down there is at the end of the build process when it is time for the new versions of Apache and/or PHP to be installed. That's very minimal. Assuming everything goes well, you'll be good to go from there.

So yeah, I think you're going about it the right way -- MySQL staged upgrade via WHM with resultant recompile of existing EA profile, followed by an EA build of your flavor/options of PHP 5.4.

You know, I can't stress enough to make you have recent backups of your SQL data. I have never ever had a problem upgrading, but I've read of people who did -- and I've seen them come on here when the sky is falling and I feel for them -- and at that point nobody can offer them much help. So just to be safe, take a recent backup of your MySQL databases.

Below is the reference I use for MySQL backups. What is written there doesn't exactly work for me - I always have to "massage" it. But you get the idea. Due diligence is the key, and you'll be fine.

http://www.thecpaneladmin.com/upgrading-downgrading-mysql/

As far as downtime / customers, if you are doing at evening / night, let them bark. I've been doing this long enough to know that you'll never please everyone. Just tell them to go spend half an hour of quality time with another human being while you do the updates instead of worrying about their trivial trinket site :)

Mike
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,258
463
Great, thanks so much for all your help! :)
I am happy to hear the information provided to you was helpful. Feel free to reply if you encounter any difficulties or have additional questions.

Thank you.