Changing or Updating Your Version of PHP for WordPress
If you want to keep your website running smoothly, it’s a good idea you change or update the version of PHP it’s running on soon since PHP 7 could soon be aminimum requiremen t for self-hosted WordPress sites by mid-2017.
And since PHP is the programming language that forms the backbone of WordPress, this is one tutorial you shouldn’t put off.
So let’s get to it why you need to upgrade, the possible drawbacks, and how to actually upgrade your server to PHP 7.Why You Should Upgrade WordPress to PHP 7
If you’re running a WordPress site on your server, then you obviously have PHP already installed. So why both upgrading wheneverything seems to be running fine?
Here are some of the most common reasons why you should update the version of PHP on your server:The plugins and scripts you have installed are no longer compatible with the version you’re using The minimum requirements to run WordPress have been bumped up The version you’re using has security holes and the upgrade includes a patch You need to switch to a stable version You want to test a different version on a local installation of WordPress or on a staging site You found conflicts with the version you’re using and the plugins, themes or scripts you have installed
These are all valid reasons, but before you go ahead and update PHP, there are drawbacks to upgrading that you should carefully consider and plan for.Possible Side Effects Include…
When you make the switch, it’s not all sunshine, lollipops and rainbows, unfortunately.
The main thing you need to keep in mind before you upgrade is that not all your plugins, themes and scripts are necessarily compatible with the lastest or specific version of PHP you want to use. If there’s an issue here, it could partially or completely break your site.
Each version of PHP brings on some variation of improvements, and possible fixes, security patches and structures to code. While some updates are less comprehensive than others, many versions include improvements or changes that make certain parts of older versions obsolete.
In some cases, entire versions such as PHP 4 and older are no longer supported. If you use plugins, themes or scripts on your site that rely on outdated PHP code and you upgrade to a newer version of PHP, the changes from the upgrade would cause old code on your site to be incompatible and break.
While this may not always happen, it’s important to review the changes you can expect to see in the version of PHP you want to use before you complete the upgrade. That way, you can review your site for code that wouldn’t be compatible so you can modify it to work.
Besides manually checking your site for possible pain points, there may be plugins available to automatically do a scan of your site to determine whether your site would be compatible if you upgrade.Checking PHP Compatibility
Here are some plugins you may find helpful in your quest for PHP compatibility:PHP Compatibility Checker This plugin lets you choose a version of PHP and you site is then scanned for compatibility issues. It also creates a report so you know exactly what to fix. PHP Pseudo Compiler A PHP validation tool to check forundefined functions or methods. Error Log Monitor If there are errors, you can enable a log to keep track of all the errors to help you know what needs fixing.
You can also enable a private error log manually by using WP_DEBUG . You can find all the details by checking out one of our other posts Debugging WordPress: How to Use WP_DEBUG .
You can also see what has changed for each version of PHP before you upgrade:Migrating from PHP 4 to PHP 5.0.x Migrating from PHP 5.0.x to PHP 5.1.x Migrating from PHP 5.1.x to PHP 5.2.x Migrating from PHP 5.2.x to PHP 5.3.x Migrating from PHP 5.3.x to PHP 5.4.x Migrating from PHP 5.4.x to PHP 5.5.x Migrating from PHP 5.5.x to PHP 5.6.x Migrating from PHP 5.6.x to PHP 7.0.x Migrating from PHP 7.0.x to PHP 7.1.x Details on migrating to the latest version of PHP
If you find that you’re using a plugin, theme or script that isn’t compatible with the version of PHP you need, you can contact the author or a developer to help resolve the issue. If you need an extra hand, you can get in touch with our expert support heroes. If you’re a member, you canopen a ticket, search thesupport forumor getlive help.
1.6 million WordPress Superheroes read and trust our blog. Join them and get daily posts delivered to your inbox - free!
You don’t have to worry about feeling left out if you’re not a member. You can try out a premium membership for free and ask away. Our support team is online around the clock so you can rest easy knowing you’ll get a response as quickly as possible.
本文开发（php）相关术语:php代码审计工具 php开发工程师 移动开发者大会 移动互联网开发 web开发工程师 软件开发流程 软件开发工程师
本文标题：Changing or Updating Your Version of PHP for WordPress