PHP version upgrade 5.3.25 to 5.6 - php

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

Related

How to downgrade the php version to 5.6 from 7.0 in a symfony project?

I'm working in a project with Symfony Framework, but i have problems with php 7.0. Can I downgrade the php version or I need rewrite the entire application?
Symfony 3 requires at least PHP 5.5.9, so generally speaking, you can downgrade if you want. Of course you might have other limitations, like additional bundles and libraries you have installed and you might have used PHP 7 features inside your own code.
If you want to downgrade you can run:
composer why-not php:5.6
This will tell you which libraries you installed will not work with PHP 5.6. You might be able to downgrade them, but obviously this is not guaranteed and might require changes to how you use those bundles and libraries. For this you will have to check their upgrade guides and "undo" those changes.
For checking your own code you can use tools like etsy's phan to check for compatibility with a specific target version of php: https://github.com/phan/phan#usage

CodeIgniter compatibility with PHP version?

I am using CodeIgniter 2.2.6 with PHP 5.5 and it works fine. Now I want to upgrade PHP to version 5.6.6 my question is, is CodeIgniter compatible with PHP 5.6.6?
I can't upgrade CodeIgniter to a new version because I have many models based on Version 2.2.6.
Codeigniter 2.2x IS COMPATIBLE with PHP7.1+.
You only need to remember:
Models/classes and so on are case-sensitive and have to start from capital letter
The same with names of files in application folder
There are problems with mysql (very old, not used now driver) so you have to use mysqli driver (but it is already implemented in CI2, check if you're not using it already)
if you have session table sometimes you'll have to truncate this table, clear cache and populate it again.
Check compatibility of software in third_party folder if you have problems - CI is not responsible for that issues.
In my case everything is working smoothly with the newest version of bootstrap & jQuery installed. However, I'm not using hooks, advanced functions and so on.
NOTE, that in most cases you can force server to use older php version using .htaccess and AddHandler command:
AddHandler application/x-httpd-php56 .php
This is last version of PHP before PHP7.
And last but not least - of course I don't recommend to use this very old version of CI, however in my opinions - in my cases - there is no sense to migrate from CI2x to CI3, in 2018 it is better to wait for CI4 and then migrate.
The Server Requirements page in the user guide says that CodeIngiter 2 requires "PHP version 5.1.6 or newer".
Note that PHP 5.6 will stop receiving active support in less than a month, so you might want to go right to version 7. PHP 5.6 should receive security patches until the end of 2018.
I can't upgrade CodeIgniter to a new version because I have many models based on Version 2.2.6.
Note also that CodeIgniter 2 is no longer supported:
the current version (2.2.6) came out in October, 2015.
CodeIgniter 2 has reached its end-of-life for support and updates, as of October 31, 2015. No further updates are planned.
We encourage you to upgrade to CodeIgniter 3.x!
There is an upgrade path from version 2.2 to version 3.1, which I encourage you to explore:
First, read Upgrading from 2.2.x to 3.0.x
Then, read the steps for performing minor upgrades
This probably isn't as hard as you think, and with the security implications I believe it's worthwhile.

Which PHP Version To Use While Migrating from 5.3?

I am working on a project which is in php 5.3+. I need to create a separate Api which is to be deployed on same server for which i am using the Symfony2.
As i need to deploy new api on same server i want to use php 5.5+ version Now i need to upgrade my old project to new version of php and mysql as the server currently is on 5,3+. I tried the php 5.4+ and mysql 5.5+ on my local system the project works fine, but when i switched to php 5.5+ it shows me error that states mysql_connect is Deprecated.
I checked on several sites and came across a solution where i can skip the deprecated message on php 5.5 + via doing some ini settings.
Now my main concern is whether is it a right solution to migrate to php5.5+ and start new feature development out there As i need to use 5.5+ so that i wont face same deprecated issue with any other thing in future in new Apior should i migrate to 5.4+.
Kindly Reply
Upgrade to the latest 5.x branch. Do not upgrade to 7.
A new major version, means that backwards compatibility is broken. You can expected that some deprecated features are dropped. In general upgrading to a new mayor PHP version requires you to upgrade your code base.
When upgrading to a new minor version, you can expect your application to keep working. Typically new functionality is added and some functionality is deprecated, but nothing is removed.
Deprecation is a notification to indicate that functionality might be removed in an upcoming version.
The notifications are meant for you as developer, to know what you need to change to make your code ready for upgrading new major version.
On the production environment you should disable these notifications through error_reporting.
The deprecation notifications should not keep you from upgrading to a new minor version. Without this upgrade it's difficult to know what to change to make your software up to date.
Conclusion: Update to PHP 5.6. Than, when you're ready and have time, change / update your code so you're not using deprecated features. When that's done, you can upgrade to PHP 7.
The question I would ask myself if I were you is how long I would want to maintain a code base with deprecated features... my suggestion is to migrate to PHP 7 (or 5.6 minimum), upgrade projects and start new feature developments... will pay better on the long run.
The short answer is "Move to PHP 5.6 now; then move to PHP 7 later, once you've dealt (or as part of the exercise of dealing with) with all the issues that would break your code in PHP 7.
The changes from PHP 5.3 to 5.6 are not really that big. The really big changes happened between 5.2 and 5.3, but if you're on 5.3 already then you've already dealt with that. Moving up to 5.6 from there is virtually seamless.
Yes, there are some backward-compatibility breaks between every version, and yes, you must read the upgrade notes for each version before you start, but in truth, 5.4, 5.5 and 5.6 were more about adding features and increasing performance than they were about breaking things.
You specifically mention the mysql extension being deprecated in 5.5. This is true, and you will get warnings. Note, however, that these functions will still work in 5.5 and 5.6. The deprecation warning is telling you that they are considered obsolete and will be removed in the future. This has now happened in 7.0. These warnings are basically there to give you fair warning; to give you time to change your code before the next upgrade cycle. Your code will still work for now if you ignore the warnings, but you should start work immediately to fix the problem.
Fixing the problem, in the case of the mysql extension, means replacing your database code so that it uses either the mysqli or PDO extensions.
The mysqli exension is basically a drop-in replacement for the old mysql extension. There are some changes (it adds an OO interface if you want to use it, and it doesn't use a single global connection object as the old library did, so you need to pass the connection object into every call), but it's generally fairly easy to convert from one to the other.
PDO is a more advanced database library which can support a range of different database types including Mysql. It is quite different to the old extension, so converting is a more complex process. But if you can use this one, it's generally considered the preferred option.

Is PHP 5.4 compatible with PHP 4.4.2?

I was recently asked about a legacy application that is running on PHP 4.4.2 on IIS 6.0. We were informed that this version of PHP is out of date and contains security vulnerabilities
I personally, have zero experience with PHP.
It has been suggested that we upgrade PHP to a later version. According to Wikipedia, the latest stable version is 5.4. Is version 5.4 backward compatible with 4.4.2?
I assume that there is an installer for PHP 5.4 that we could run that would install the new version of PHP. Would that work safely and the legacy application would still run fine?
Are there any breaking changes in newer versions of PHP that might make upgrading the legacy PHP application risky?
Look at this, check for any deprecated code (especially preg VS ereg ) -
http://www.php.net/manual/en/migration5.incompatible.php
Look for the general differences -
http://www.php.net/manual/en/faq.general.php#faq.general.differences-45
Check about the migration -
http://www.php.net/manual/en/faq.migration5.php
EDIT -
One more general link, may be helpful at times -
Check Change Logs

PHP 5.2.x and 5.3.x

What are the differences between PHP 5.2.x and 5.3.x?
Because all extensions are made separately for these.
Thanks a lot.
PHP 5.3 is a newer version with a number of new features (closures, namespaces, etc.). Is is the current stable version for the PHP project. PHP 5.2 is an older version, which is now heading towards the end of its support cycle - now only important security issues are being fixed. If you start a new project, start it with PHP 5.3.
When changes in PHP core are made that change the structure enough that extensions can no longer be compatible - the second digit in the version number is incremented (5.0, 5.1, 5.2, 5.3). The first digit is for very major changes changing the whole language (like between PHP 4 and 5). Between 5.2 and 5.3, you can expect source code compatibility (though some incompatibilities exist) but not binary module compatibility.
You can find an exhaustive list of backwards incompatible changes from 5.2 to 5.3 on PHP.net.
PHP extensions depends on the phpapi version among other things, along with the Zend Module API version and the Zend Extension API version, which as far as I'm aware, changes at each PHP version because of the core changes made to the language. This explains why each PHP version has a new build for each extension.
You can find the answer in PHP official website.
In this page: Migrating from PHP 5.2.x to PHP 5.3.x.

Categories