Upgrading from PHP 5.6 to 7.4 can be a daunting task, but it is important to do so in order to take advantage of the many new features and performance improvements in the latest version of the language.
Before starting the upgrade process, it is important to thoroughly test your application on a development or staging server to ensure that it is compatible with PHP 7.4. This will allow you to identify and fix any issues before deploying to a production environment.
One of the biggest changes in PHP 7.4 is the deprecation of several functions and features that were previously available in PHP 5.6. For example, the create_function() function has been removed, and the mysql_* functions have been deprecated in favor of the mysqli_* or PDO_* functions.
Additionally, certain syntax changes have been made in PHP 7.4. For example, the list() function now requires parentheses, and the callable type has been replaced with Closure.
It is also important to note that PHP 7.4 has removed support for several older versions of popular extensions, such as mcrypt, and openssl. It’s important that you update these to the latest version of these extensions to be compatible with PHP 7.4.
Once all compatibility issues have been addressed, the actual process of upgrading can begin. This typically involves updating the PHP version on the server and updating any necessary extensions.
It’s also important to note that you should also update any dependencies and libraries that are used by your application. This includes updating any frameworks or libraries that are used by your application.
Once the upgrade is complete, it is important to thoroughly test your application again to ensure that everything is working as expected.
Some major issues we faces post migrations are:
We migrated from mysql_* with PDO
- We implemented PDO in such a way that it can also handle read-replica in future Db::getPdoRead, Db::getPdoWrite, but there was a challenge in the beginning, team was making mistake to using it in right object which actually created problem for form data not being stored in database,
- Converting bigger SELECT with multiple tables joins and multiple parameters query to PDO
- Another issue we faced was after conversion sometime response got swapped index_value to key_value or voice-versa
- Other issue related to same we faced was we have to fetchAll() record but we use fetch() or voice-versa we created data mismatch
- We decided to replace mysql_real_escape_string() with addslashes() which created another issue on production while saving html contents.
Merging branches, lots of conflicts, if someone forgot to rebase or worked for weeks without taking updates. It took week to resolve conflicts.
In summary, upgrading from PHP 5.6 to 7.4 can be a complex process, but it is important to do so in order to take advantage of the many new features and performance improvements in the latest version of the language. It’s important to thoroughly test your application before and after the upgrade, and to update any necessary dependencies and libraries.
Thanks for taking the time to read this. If you have any further questions or need more information, please don't hesitate to ask.
Top comments (0)