From PHP 5.5 to PHP 7.x – Migration, Mistakes And Learning

An unusual choice, many might say, but at MSG91 we have been using PHP for our server-side application for years now and continue to do so.

Agreed, as a language, PHP comes with its share of shortcomings, but, the environment indemnifies the flaws and you know how.

A lot has been written about why you should use PHP or why not, also, what are the benefits of upgrading from PHP 5.0 to PHP 7.0, so we are not getting into the nitty-gritty of it here. We are here to share our insights, our experience, our learning so when you plan to migrate you already know where to go next.


Migration, Mistakes, Learning

PHP – 5.5             MySQL – 5.5          Mongo DB – 2.7         Drivers – 1.2

2015 December – PHP 7.0 version launched

From the day of the launch we wanted to upgrade but the main challenge was the ongoing development. Our focus lies on our features – making it easier for our customers – so we just couldn’t figure out how to give attention to both, the development and the migration.

Hundreds and thousands of lines of code had to be re-written; you know how it works. Also, since we are working on PHP, MySQL and MongoDB, all of them had to be upgraded, at the same time.

2018 June – The Migration Project Begins

PHP 5 to PHP 7

  • A dedicated resource was brought onboard
  • Extensive research
  • The existing code was copied
  • Every day, tens and hundreds of lines were rewritten
  • Every day, the changed code was extensively reviewed
  • Simultaneously, the existing code was worked upon without losing focus on the development.

What used to happen is when the new code reached a certain status, the existing code used to go further ahead due to the ongoing development.
It took us a total of 2 months to rewrite the entire code (yes, we did take our sweet time), review it, and then 1 month for testing it.

Our developers worked diligently – day and night – to not only upgrade the platform but, to ensure no glitches come in the way of our customers.

In their own words, “We used to go home at 8 in the evening and come back to the office around 10 at night. Shift the entire platform on PHP 7, note down the negatives and the positive for each – PHP, MySQL, MongoDB; shift back to the original platform early in the morning, go home and be back by 12 noon.”


August 2018 – Project Success 

It’s been 4+ months since we migrated on PHP 7 and we can proudly say, we are up and running.

We did face our set of challenges (the developer who was recently married had a few more 😉), but thanks to our extensive research and our extensive code reviews, our set of challenges were limited and so were our mistakes.


Mistakes We Made – Learn From Our Experience And Avoid

  • We waited for quite some time before we upgraded
  • Had to change every line of code – so it should never be Destroy Baghdad – but, Destroy <City>


Changing Architecture – Key Points To Remember

If you are planning to migrate to an upgraded language, here’s what we suggest –

  1. Keep it in routine – every time a new upgrade comes, don’t wait for too long
  2. Use latest tech state – it’s already upgraded so bug-free
  3. Easy code to upgrade – Makes your work simpler
  4. Use hosted solutions – Perfect for a small team so you are saved from the process of checking every element and keep your focus on the development
  5. Don’t hurry the process – Take your time
  6. Server cost save – Client increased response rate
  7. Don’t waste resource on writing the code – Review the code thoroughly
  8. Mongo DB – It won’t be that challenging if not using MongoDB

It’s not only us who are elated by the up gradation, but even our customers have started to sit up and take notice the difference in the API response/query time. Where at some places the response/query time used to be 0.10 seconds it has reduces to 0.08 seconds and at some places it has gone down from 0.10 to 0.02 seconds (mindblowing).

Views: 150