Podcast Episode

307 – Updating PHP to Version 7

Announcements

Is there a plugin for that?

With more than 50,000 plugins in the WordPress repository, it’s hard to find the perfect one. Each week, I will highlight an interesting plugin form the repository.

For more great plugins, download my 50 Most Useful Plugins eBook.

Duplicate Posts allows to clone a post or page, or edit it as a new draft.

Updating PHP to Version 7

We talk about updating WordPress, themes, and plugins regularly, but never talk about updating the technology behind your site.

Version 7 Improvements
* Performance improvements with PHP7 will be significant (2-3x improvement over PHP5)
* Exception handling – errors will be caught as exceptions
* Testing tools are available to forward test your code against the new framework.

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.

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.

  • PHP Compatibility Checker – This plugin lets you choose a version of PHP and you site is then scanned for compatibility issues. It also generates a report so you know exactly what to fix.

  • PHP Pseudo Compiler – A PHP validation tool to check for undefined 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.

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 can open a ticket, search the support forum or getlive help.

Updating or Changing PHP in cPanel
It may not be possible with all types of hosting, but if you see a PHP Version Manager button in the control panel, you’re free to make the switch when you’re ready.

It may be in different locations depending on your host, but click PHP Version Manager and navigate to the directory where your site is located that you also need to upgrade.

Choose one of the available PHP versions from the list, then click the Save button.

Thank You!

Thank you to those who use my affiliate links. As you know I make a small commission when someone uses my link and I want to say thank you to the following people. For all my recommended resources, go to my Resources Page

Full Transcript

Business Transcription is provided by GMR Transcription.

On today's episode we talk about the importance of updating PHP, right here on YourWebsiteEngineer Podcast Episode #307.

Hello, everybody, welcome back to another episode of YourWebsiteEngineer Podcast.

My name is Dustin Hartzler, and today we'll be talking about PHP, and it's something that runs behind the scenes on our websites but it just gets kind of under the radar, so we don't talk about it a whole lot. But today I wanna talk about it and talk about why we should be upgrading to Version 7.

But before we go do that let's go ahead and dive into the announcements. There's two big things that I wanna talk today that's happening in the WordPress space.

The first one is that a custom CSS module may be coming into the Customizer. And this was an article that first I saw on WP Tavern, and then I went over and was reading over on the Make.WordPress.org Core blog. And it was adding a proposal to add an area in your Customizer in Version 4.7 of WordPress, to be able to add CSS right from the Customizer. A lot of times if we wanna make simple changes to our website we've got to go and install some sort of plug-in to add CSS; we've got to turn on that feature in Jetpack. It's just not a really good way to add custom CSS to our website.

And so this is going to add a CSS Editor right to the Customizer. By bringing it to the Customizer it does a really cool thing. The Customizer gives you the ability to do a live preview, and with other plug-ins you can't do this. And so, in general, let's talk for example the Jetpack Plug-in. If you wanna add CSS you have find the CSS or you have to write it, then you have to save it, then you have go out to the front page of your website and you have to refresh it to see if the CSS actually was written and targeted properly, and all those good things.

Well, with the Customizer, being in the Customizer I guess, that gives us a live preview. So we write a line of CSS, then we go to the live, we see the live preview right there to the right, and we can see if that targeted and actually worked the way that we intended.

And so it's a really neat thing, it's a really good feature I think that could be added to WordPress and it just makes all of those WordPress plug-ins that do CSS, only it makes them kind of obsolete. I would love to have the ability to add custom functions within the dashboard that adds it to a plug-in, but that's not something that we're talking about here. It's mainly just something to start talking out and try to figure out if this is the best course of action, the best way to go, or if it could be added to 4.7, or if it's going to be coming in a later version. So I thought that was pretty interesting, the story in the news. And I just wanted to share that as well.

And then the other thing that's happening in the news or an article that I found was on November 12th, so just in a couple of weeks, the Polyglots Team is to host the 2nd Global WordPress Translation Day. And so the Polyglots is just the team that helps to translate WordPress into all of the native languages across the world. And they are setting up the Global Day as, the second day that this is going to be happening is, November 12th and it'll begin at UTC-0 with a live session opening from Tokyo. They're working on, or they've had contributors help to translate WordPress into more than 160 languages, and so they're just working on growing the team, pushing awareness out there so people know about this. And this is definitely something that if you are somebody that speaks multiple languages and you have the ability to help to translate different pieces of WordPress, they could definitely need some help.

I would love to help with this project, but my English is okay, I guess I should say. No, my English is pretty good, but my Spanish is just like very, very, beginner-ish, and so I don't think I can do a very good job helping to translate. But there's tons of other things to work on, whether it's just updating documentation and doing different things. And so if this is something that's interesting to you take a look at the link in the Show Notes so that you can find out more about this World Translation Day.

All right. Is there a plug-in for that? There is. And I've probably talked about this one before because it's a pretty popular plug-in. It's got more than one million active installs. But this one is called Duplicate Post, and it allows you to clone a post or a page, or you could edit it as a new draft. It is pretty simple.

It's a plug-in that you can go and when you hover over in the All Postman, your All Pageman, you can say Clone or Duplicate, and it's really nice. Because especially if you have, like I could use this very easily for YourWebsiteEngineer podcast episodes because I have, each post and page is very, very similar, the podcast follows a very similar pattern. You know, we've always got the announcements, or we've got the plug-in of the week, we've got the main content, we've got the closing. Like, I could just duplicate those posts and fill-in those different areas. So if you have this, I know that this feature, the duplicate post is built into WooCommerce and it's really nice to be able to duplicate products, especially if they're very, very similar and the price points are similar or whatnot.

And so this is just a plug-in that will save you an awful lot of time if you are creating content that's very, very similar or if you ever just need to copy things. You just click the button once and it automatically copies it, versus opening your post up, copying all the html, and then pasting that to a new post, and then try to copy all the setting and whatnot. This is the definitely much, much easier way to go.

So it's got more than, it's got actually 244 five-star reviews, and like I said over a million active installs. So if that is a plug-in that you're looking for, I highly recommend looking for Duplicate Post on the WordPress Repository.

All right. And the last thing I wanna share today, or the main thing that I wanna share today is talking about PHP a little bit. I talk about all the time, we talk about updating WordPress regularly, we talk about updating themes or plug-ins regularly, making sure we're always on the newest, latest, and greatest version, but I don't think I've ever once talked about updating PHP. And this comes up a lot when I help customers with their WordPress or their WooCommerce site because a lot of times that they are running older versions of PHP that some of these new features and new functionality and new updated versions of the plug-ins don't work with because they're not compatible with these versions of PHP.

And so today I just wanna talk a little bit about PHP, a little about what it does and some of the new features that are coming out in PHP 7, and just a few things. Just to keep you on the loop of what's going on. The PHP 7 came out in November of last year, and so we we're almost at a year's point and it's very, it's not very widely accepted that this is the standard version of WordPress. And so I just wanna talk about this a little bit and just kind of dive into what PHP is and all that good stuff.

So if you are one of those people that love to keep your website updated, you're always making sure all the plug-ins, the themes, everything's updated, you're following the standards, you're just making sure that everything is running the latest and greatest version so that you don't have security vulnerabilities and your plug-ins are all updated and whatnot. Then it's probably a good idea to update your minimum version or the version that's running on your web server to version PHP 7. And it looks like this could be a minimum version coming for self-hosted WordPress sites by mid-2017. So we're just kind of getting a jump start on getting your site ready for this, whenever they're gonna say this is the minimum it takes for a WordPress.

And so PHP is the programming language that forms the backbone of WordPress. It is the piece that takes the, it's able to find the, let's see – PHP is a dynamic language that allows it to go and find information in the SQL database. And the database is where all your data is stored or what plug-in you're using, what theme you're using, all your setting for all your plug-ins, all your posts, your pages, your store, all that kind of stuff is all stored in a database. And PHP is the programming language that allows you to build websites that will dynamically generate the content based on what's in the database. And so we're talking about the brains behind and the reason that webpages are generated for a WordPress. So there's a few reasons that I wanna talk about that's why we should upgrade to PHP.

But let's talk about a couple of improvements. So right now, most webservers are running on version 5, whether it be 5.4, 5.5, 5.6, it's the range that most webservers are using. Then it skips to 7. I'm not sure with the numbering scheme but there's no PHP 6, we will go straight to 7.

And three big things that we should be aware of what PHP 7 includes is it has performance improvements, and so it's significantly faster, up to two to three times improvement over PHP 5. So that means when you go to a website page it's gonna load two or three times faster because PHP is loading that data two or three times faster.

They also do exception handling, so errors will be caught as exceptions instead of fataling out your site. So this is a really good one. If you are tinkering with your website and you accidently forget a semicolon or you don't close your loops or do whatever, then in PHP 5 it's going to fatal out your website and it's not gonna work. Well, with PHP 7 you'll get an exception, or you'll get a – it's not gonna fatal out your site, which is really nice!

And then there's also more testing tools that are available in version 7. This isn't something that really applies to me or I don't really understand this type of thing because that's not the type of testing that I do. But if you are a developer and you wanna test your code against a new framework they've got better testing tools for that. So why should we update our PHP to Version 7?

Well, there's a few reasons out there, that some of the plug-ins or scripts that we may be running on our webserver may no longer be compatible. As we get newer and newer it's just like, think about PHP 7, or PHP 5 to PHP 7, very much like the operating system. You know, like the Mac operating system or Windows, eventually they stop supporting the older versions and then you have to upgrade to the newer versions. And just think about us upgrading right away, not right away because it's been out for a year almost, and so it's just the process of getting ready for better technology and faster technology.

The minimum requirements for WordPress will be bumped up some day in the future. And it's better to always do these before you actually have to. You know, you think about it and you spend time, say it takes a month for us to update and then to test to make sure everything works okay. Well, that's a lot better than doing it three days before it actually is a requirement when the new version of WordPress comes out. So that's another thing to think about.

The version that you are running may have some sort of vulnerability and it might be patched in version 7. You might want to test different versions of WordPress or plug-ins or themes, and you may need a newer version to get all of the advanced functionality out of there. You may have conflicts with the version that you're using with your WordPress site. I know that we have a lot of conflicts. A lot of things don't work with PHP 5.4 with WooCommerce, and it's takes a minim of 5.6 to be able to run WooCommerce perfectly, and everything worked the way that it needs to. So those are some reasons to update.

There are some possible side effects. This is your main operating system and the main piece of the puzzle when it comes to dynamically generating those WordPress sites. And so each version of PHP has some improvements over the last one, but sometimes there's plug-ins that don't fully support PHP 7 and they just don't work right. PHP 7 has deprecated some features or a functionality, and your old plug-ins or it could be some older plug-ins that are causing issues that aren't using the new available functions to call different things and whatnot. So, yeah, there's some things that could happen. You could upgrade and then all of a sudden things break on your website. But, luckily, the cool part is that there's plug-ins out there that you could find helpful to see, you could check your PHP compatibility.

So, the first one is called PHP Compatibility Checker. And there'll be a link in the Show Notes for Episode #307 for this one, and it's a plug-in that allows you to choose different versions of PHP on your site, then your site is scanned for compatibility issues. It can create a report so you know exactly what to fix. This is really, really nice and I plan on doing this on my website just to make sure that everything is set in stone and I'm ready to upgrade, and just get all of my websites updated to PHP 7. I mean, I've given these instructions like hey you should do this, hey you should do this, hey Dustin you need to this as well. Because I haven't checked and I know that some of my webservers are funning PHP 5.6, so I need to go ahead and update those.

There's another couple of plug-ins that are out there. One is called PHP Pseudo Compiler and it's a validation tool to check for undefined functions or methods. So that one's good to use, so that one is another one that will look to see if there's functions that are old functions that are no longer available in PHP 7. There's also an Error Log Monitor. If there are errors, then you can enable to log and track all of these errors so you can kind of find what might be breaking and what may be causing some issues on your website.

So, yeah, those are just some things to do to check for your version of PHP to make sure that all your plug-ins and your theme is compatible.

Now once you've looked at it and maybe you figured out that, okay, all my plug-ins are able to be updated, it's not a big deal, maybe we should just go ahead and do it, and what's the steps and the processes as well. You can do this via SSH or you can do it via cPanel. And I highly recommend the cPanel because it's just super-easy.

You basically go into your cPanel access, and this is going to be different on all different webhosting companies. But basically if you're using something that has the regular cPanel with the list of all the different icons, we're gonna look for PHP, we're just gonna go "PHP version manager" or it's something like that. And then when you go there it'll normally have several options, and it'll say you can go to PHP 5.3.2 or PHP 4.45 or PHP 7.011 or whatever the case is, you'll just wanna go ahead and see. One of them maybe is set as the system default, and what you can do is you can basically, it's a radio button and you just move the radio button from the oldest version wherever you are and then move it all the way up to version 7. And then you can click Save, and then you can go refresh your website and you can see. It'll restart running PHP 7 just like that; it's just really, really fast.

The way the web companies do it is they normally have several versions of PHP running and you're just picking the one that you wanna use and it's, it's as simple as that. It's as simple as clicking a button, choosing a radio button and saving it, and then if it breaks your entire website, what you can do is you can just roll back to the previous version. You're just checking the different boxes, really, really simple.

So the Action Item this week is to spend a little bit of time using these plug-ins to check to make sure that your website is compatible with PHP 7. Make sure that it can work with those newer versions, and if so click that button and update to the latest version. All right?

Well, that's what I wanted to share with you today. Thanks so much for tuning in. And if you're new and listening from maybe your heard me speak at WordCamp Cincinnati this weekend, thanks for coming and tuning in and checking into an episode. I had a lot of fun at WordCamp Cincinnati. It was a great event; it felt like second or third year event it was just run so smoothly even though it was the very first time that they held a WordCamp in Cincinnati. I had a lot of fun. I spent time teaching the lesson that I did back in August to WordCamp Columbus, and I did this all on how to customize your theme the right way. Great overall response, and just a fun time. I'm getting to meet with people that are running WooCommerce, using WooCommerce, and helping them fix their websites and get their sites up and running.

So that's what I wanted to share with you today. Remember PHP 7. We wanna be ready for the switch, and now is as good a time as any. We're getting into this lull, there's not a lot going in the WordPress base, we've got another month-and-a-half until WordPress 4.7 comes out. And so it's probably great time to spend a little time tinkering, making sure we're ready for the future, and upgrading to PHP 7.

That's all I've got for you this week. Take care! Bye-bye.

    • Michael Works (@MichaelWorks) Reply

      Thank you Dustin for another informative Podcast! This really helped me understand some of the issues I’ve had lately on my work website due to an old PHP server. Keep up the great work!

      Oct 20, 2016

Leave a Reply