I recently upgrade a site from PHP 5.3 to PHP 7. I can edit pages in the admin, but when I click update, it never finishes, but the changes show up on the page itself. This problem doesn't happen if I revert to 5.3. The memory limit is set to 128M, so I have no clue what could be causing this, other than the upgrade from 5.3 to 7. Did something change between the two versions of PHP that could cause this?
Did something change between the two versions of PHP that could cause this?
Short answer: Yes it did.
The changes between PHP 5.3 and 7.0 are huge, including a lot of backward compatibility breaks.
I suggest reading the PHP manual where they discuss these issues for each version:
PHP 5.4 BC breaks
PHP 5.5 BC breaks
PHP 5.6 BC breaks
PHP 7.0 BC breaks
If you're doing this upgrade, you need to make certain that the software you're running (ie Wordpress and all the plugins and templates that you've installed) will work in PHP 7.
You would be well advised to take the upgrade in steps. Most of the breaking changes were between 5.3->5.4 and 5.6->7.0, so maybe try upgrading to 5.5 or 5.6 first before attempting the jump to 7.0.
You may also find that with the size of the version jump you're attempting, you might be forced into a staged upgrade anyway -- if you're running older versions of Wordpress and your plugins, there might be intermediate upgrades that you have to make to them as well before you can get to a version that works in PHP 7.
Finally, you may decide to only take your upgrade to 5.6 for the time being, as it will be a lot less challenging. You can complete the move to 7.0 later. This is because the update 5.3 to 5.4 or 5.5 or 5.6 should be fairly safe, as the breaking changes in 5.3->5.4 were a long time ago now and any developer keeping up with the times will have had plenty of time to dealt with them by now. However 7.0 is a much more recent release, so not all code has been updated to work with it yet.
The lesson to learn here is to keep up with version changes as they happen, rather than waiting for years to do a single big-bang upgrade.
Related
i am thinking about migrating from php 5.3 to php 5.6 on my company's server, but i'm concerned about how it may affect other websites on the server, especially joomla and wordpress app's, which were hosted some few years back, like 2011. I was trying to host a new website that uses 'get_result()' but i was having some errors when hosting it, even though mysqlnd driver was present, i could only fetch my results using'bind_result()'. so i debugged it, and found out that it's because of a certain driver nd_mysqli which is present in php 5.6. So that's why i decided to upgrade. Are there any issues that could come after this upgrade? Or is there another way of getting the nd_mysqli driver? though honestly i'd prefer to upgrade, this is 2017, it's about time for that.
A fair amount has changed between 5.3 and 5.6, so it is hard to say exactly what issues you may face.
If you are running recent versions of joomla and wordpress the chances are they are compatible as the relevant developers will already have fixed any issues, but if they are as old as php 5.3 then you may run into issues.
Whatever you do, you should create a test server to be sure.
The following pages show the changes that have been made:
http://php.net/manual/en/migration54.php
http://php.net/manual/en/migration55.php
http://php.net/manual/en/migration56.php
You really should upgrade though php 5.3 no longer receives security patches and you are likely vulnerable to something.
It depends on the versions of Joomla and WordPress.
For example, it might be possible to get Joomla 1.5 and older versions of WordPress running on PHP 5.6, but you will need to suppress strict errors as per https://stackoverflow.com/a/9984309/1983389 or similar. It will also depend on what extensions / add-ons are being used.
As #Theo says, it is probably best to do this change in a test environment first so that any issues can be identified and resolved before proceeding with the change on the production server.
An alternative and better long term strategy might be to upgrade the Joomla, WordPress and any other applications on the server before upgrading PHP.
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.
I have a simple question why do we need to upgrade PHP version on a live server? Is there any good reason to do so? I'm confused; we're using PHP 5.3 and our CEO doesn't want to update to PHP 5.5 which is recommended in Laravel 5. Can somebody give me reason why we should or we shouldn't do it?
Further to some of the comments on your question:
Do we need to upgrade PHP
The answer to this part of the question is "No". In some cases it might not be possible to upgrade as newer version can cause applications to break if they rely on older features.
Do we need to upgrade PHP for Laravel 5
The answer to this part is "Yes". You will have to upgrade for Laravel 5 as it relies on newer features of PHP that only exist from PHP 5.4 (Laravel 5) and 5.5.9 (Laravel 5.1).
Should we upgrade PHP
You didn't ask this question, but I put it in here because Yes, you should. Versions of PHP have a lifetime. They are supported in full for bugs for a while, and then they are supported for security flaws for slightly longer. However, after a while, versions of PHP will no longer receive any support. Security holes might be found in older version that will never be patched. You should keep your version of PHP up to date in order to remain safe from PHP vulnerabilities that may have been discovered.
As always, the PHP website contains all the information about the currently supported versions of PHP: http://php.net/supported-versions.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
I'm starting to learn PHP. I would like to use PHP 5.3 because it's the newest version so far. I'm working on a project in which I'll use PHP 5.2 scripts that someone gave me.
Are they going to run just fine even though I'm using PHP 5.3?
PHP.net features a guide for upgrading from PHP 5.2.x to PHP 5.3. This includes a section on backwards compatibility.
From my experience, the transition from 5.2 to 5.3 went pretty smoothly smoothly. The only problems I had with my app was to ensure my DateTime setting were property configured in my php.ini, and filter out some overly-agressive deprecation warnings that started showing up.
No, 5.3 is not backward compatible, and by all means it shouldn't be seen as a minor version upgrade.
There is a page dedicated to incompatible changes: http://www.php.net/manual/en/migration53.incompatible.php
Also consider functions you have designed but have been accepted into 5.3. Since php doesn't support overloading or overwriting of functions, this will give an error.
For the most part, minor version releases aren't going to cause you problems. You should be okay.
Obviously, if you do have any problems, you'll want to make sure you have error_reporting set to see all errors. PHP: error_reporting
Also, check the manual for changes in 5.3 from 5.2: Migrating from PHP 5.2.x to PHP 5.3.x
There are some minor issues. Call time pass by reference are deprecated. There are new reserved words (ie. goto).
php has no backward compatibility in all version. It often removed some functions when it changed version. The problem occurs when you have to upgrade server and need to change php version but some php scripts no longer work with new php version. You also have to correct php script which is a bigger job. But if the script belong to other users rather than yours, you can't upgrade those scripts. This is a real headache situation that I'm fed up with php and switch to perl instead for backward compatibility reason.