PHP 7.4 Just Came Out, and So Did Our PHP Version Switcher

PHP is still one of the most popular languages used to build the web. The newest version, PHP 7.4, was released today — and Business and eCommerce plan customers can opt to start using it immediately.

WordPress.com sites run PHP 7.3 by default — it’s still our recommended version, since it’s been stress-tested across all of WordPress.com — but if you have a site on the Business or eCommerce plan and want to be on the leading technological edge, you can opt to switch to version 7.4 immediately.

Head to My Site > Manage > Hosting Configuration to find the new PHP Version Switcher:

Choose which version of PHP you want your site to run on, click the “Update PHP version” button, and voilà.

(Note: All sites with eCommerce plans can make the switch right now. Sites on the Business plan need to have either an active plugin or a custom theme to use the PHP Version Switcher.)

PHP’s evolved with each version 7 release, and PHP 7.4 promises to have the strongest performance yet. It will eventually power all WordPress.com sites, but Business and eCommerce customers can take advantage of the update today!

13 Best Text Editors to Speed up Your Workflow

A text editor may sound boring to some, but it’s the lifeblood of so many organizations around the world. From development teams to publishers, text and code editors are intertwined with almost everyone’s workflows. Many of us bounce in and out of them all day long. Whether you’re writing PHP, or simply taking notes for a project, there are plenty of great tools to make this task a little easier. Today we’ll outline the absolute best text editor solutions.

Some of the text editors are excellent for experienced developers, while others are more for beginners or writers. You’ll also find some great editors for collaboration, real-time code sharing, and much more.

Collection of the Best Text Editors (And Some IDEs)

Here’s a collection of our favorite text editors. Some of these are also considered IDEs, which stands for “integrated development environment.” Meaning you can do a lot more with them than simply write code. We highly recommend testing each one to see which one works best for your own workflow.

Still looking for that perfect WordPress host?

Try Kinsta’s premium managed WordPress hosting to experience your site without problems.
  • Styleized controls representing management Fully managed
  • Shield with a tick representing securitySecure like Fort Knox
  • Merging lines representing migrationsFree migrations
  • Three right chevrons representing server speedUltimate speed
  • Circular arrow with center dot representing backupsDaily backups
  • Offset hexagons representing our server stackGoogle Cloud Platform
Check out our plans

  1. Sublime Text
  2. Atom
  3. Notepad++
  4. CoffeeCup – The HTML Editor
  5. TextMate
  6. Vim
  7. UltraEdit
  8. Coda
  9. BBEdit
  10. Komodo Edit
  11. Visual Studio Code
  12. Brackets
  13. CodeShare

1. Sublime Text

The Sublime Text editor is definitely one of our favorites! It offers a free version for testing, but all continual users are required to pay $80 to keep it active. While $80 might sound steep for a text editor, it’s important to note that the licenses are per-user, rather than per-machine, so you can enjoy Sublime Text on as many computers and operating systems as you wish with your license.

As for the features, Sublime Text has an advantage in that it’s extremely lightweight (low resource usage), but still keeps around some of the more advanced features you would expect out of a top text editor. The primary benefit is that Sublime Text offers shortcuts and search tools for immediately finding certain functions and making changes to multiple lines at once. Jumping to specific symbols or words takes only a few seconds.

In addition, Sublime Text automatically creates an index of all functions and methods so that you can work with the shortcuts and customize it for locating bits of code while working.

Sublime Text editor

Sublime Text editor

Going along with the trend of shortcuts in Sublime Text, the text editor lets you type in a few keystrokes to move directly to menu items. So, if you wanted to sort something in your document, you wouldn’t be required to sift through the entire menu to find that functionality.

Sublime Text has a Python API, meaning that a wide variety of plugins can be integrated with the text editing solution. This includes the thousands of plugins that are consistently created by the Sublime Text community.

Which Features Make This One of the Best Text Editor Tools?

  • Sublime Text lets you test out the text editor before committing to the investment. Although it’s a bummer you have to pay for this text editor, you at least get to try it out–and the pricing isn’t that expensive.
  • The text editor runs on multiple platforms such as Mac, Windows, and Linux. It’s also cross-platform, so one license will work on all of your devices–no need to purchase more.
  • Sublime Text provides split editing for managing and editing files next to each other. You can also open multiple windows and place them on different monitors.
  • The Python API opens up opportunities to upgrade Sublime Text with plugins you, or other people, create.
  • Sublime Text has extremely user-friendly and powerful shortcuts. From finding and modifying multiple lines to locating certain functions in the menu, Sublime Text should make shortcut lovers happy.
  • You can also customize just about anything in Sublime Text. This is especially true when talking about shortcuts and menus. We recommend tweaking the settings to open files in the same window (new tab).
  • Has some great community themes available. Check out the Dracula Sublime theme.

Sublime Text makes the most sense for heavy coders. These developers will enjoy the shortcut functionality and the high level of customization. The cross-platform abilities are also nice for launching the same text editor on all machines.

2. Atom

With Atom, you gain access to an open source text editor with developers in mind. In fact, the creators of Atom state that they made it just for developers. Also, there’s a community of developers who contribute themes and plugins, much like WordPress or some other opensource tools. An experienced developer should have no problem working with Atom, since it offers clean collaboration tools, a sleek editor, and some great organization tools for keeping your projects in check.

All of your projects can be shared and edited in real-time, helping out teams that are far away from each other or simply those teams that want a more dedicated workspace. Furthermore, Atom has a GitHub package already included with the text editor. This way, your team can create everything from branches to stages in one interface.

Atom text editor

Atom text editor

Another great thing about Atom is that it’s a cross-platform system, working on operating systems like Linux, OS X, and Windows. The smart autocompletion is one of my favorite features, and the multiple panes should make you feel right at home with several panes open to edit code between files. Much like an iPhone (or WordPress,) Atom has extras that you can install called packages. These are offered to expand the functionality of the basic text editor. You can also install themes to make your editor look prettier and easier on the eyes.

Which Features Make This One of the Best Text Editor Tools?

  • Atom is an opensource text editor with a large community of developers. This means you get consistent updates and new themes and packages. Check out the Dracula theme for Atom.
  • It’s a cross-platform solution that works on the major operating systems.
  • The editor is useful for coding alone, but its true strengths come into play when you need to collaborate with other people. All of the editing and creation can be done in real-time.
  • Atom provides a GitHub package for integrating and doing things like pull requests and resolving merge conflicts.
  • You can search for new packages and themes right from the text editor.
  • It’s fairly easy to edit your code with smart autocompletion, a file system browser, and a find and replace feature.
  • Atom offers multiple panes for comparing and editing code side by side.

I would recommend Atom for those developers who want a collaboration tool in addition to the text editor. You can manage projects with other developers and see changes right in front of your eyes. Atom is also nice since it’s opensource–meaning you get it for free, the community is solid, and you can choose from packages and themes. In short, if you like working with WordPress, Atom seems to present itself in a similar fashion.

3. Notepad++

Debatably the most popular advanced text editor on the market, Notepad++ comes in a compact package with no fees and powerful editing components. It is given away for free on a General Public License, meaning that all developers and content creators are able to take advantage of the text editor right after a quick download. Notepad++ runs on Microsoft Windows, and it strives to use less computing power than the average text editor.

One of the things that makes Notepad++ stand out is the fact that it’s already been translated into over 80 languages, allowing access to people all over the world. Furthermore, you’re able to translate Notepad++ into your native language if you don’t find your language on the list of translations.

Notepad++ text editor

Notepad++ text editor

Writing code and manipulating text in Notepad++ comes easy, as it utilizes syntax highlighting and folding. There’s also a wonderful search and replace tool, along with an entirely customizable user interface. For instance, you might want a vertical tab or a document list–all are possible with the Notepad++ text editor.

Which Features Make This One of the Best Text Editor Tools?

  • Notepad++ is completely free for everyone to use.
  • The text editor is already translated into dozens of languages, and it provides the documentation needed to translate into more languages.
  • You receive a multi-view editor with syntax highlighting and folding.
  • The customization tools are easy to understand and powerful enough for the most advanced developer.
  • The auto-completion settings ensure that you can finish functions, parameters, and words without having to type them in over and over.
  • It offers a multi-document interface for switching between tabs and managing multiple projects at once.
  • Notepad++ provides a list of plugins to improve the functionality of the text editor or integrate with other programs.
  • You can open a function list, which reveals an outline of all functions found in the current file. This also includes a search engine for quickly locating functions in large documents.

If you’re a beginner who needs a text editor, Notepad++ is far easier to understand than some of the other options on this list. Not only that, but you’ll enjoy the ability to locate words and replace them all, while also revealing certain bits of code with highlighting. As for advanced users, Notepad++ also does the trick, with its syntax highlighting for HTML, PHP, and JavaScript. The plugins also help out when trying to connect via FTP or integrate with other text editors.

4. CoffeeCup – The HTML Editor

CoffeeCup’s HTML Editor provides extremely advanced text editing for coding and overall web design management. The editor has a free trial, but in order to continue, you must pay the $49 one-time fee. There’s also a fully free version, but the features are pretty watered down.

We like CoffeeCup for creating HTML documents, but you might consider avoiding it for many other code languages. However, it makes sense to take advantage of CoffeeCup if you’re simply learning a language like HTML or PHP.

CofeeCup The HTML Editor

CofeeCup The HTML Editor

As mentioned, creating and editing HTML is fairly simple with CoffeeCup. This takes your web design to the next level, especially with the tools for tag references and code completion. There are plenty of components to take advantage of that instantly update various elements across your entire website.

What’s more is that the CoffeeCup text editor comes with several responsive website themes. You may want to start from scratch if you’re trying to learn more about coding, but the themes expedite the process for when you need to generate client websites by a deadline.

Which Features Make This One of the Best Text Editor Tools?

  • CoffeeCup has a free version and free trial. Also, the premium version is affordable.
  • This is one of the best text editor options with themes. These aren’t completed websites, but it gets you close to some designs that might look appealing for some of your clients. Why reinvent the wheel when you can start further into the process?
  • The FTP connection allows you to go live with your website with the click of a button. Publish your website anywhere you want by selecting a server or web host.
  • CoffeeCup is one of the more visual text editors, with a standard split-screen view, but also a live preview to see what your code creates on the frontend.

CoffeeCup is a great choice for those interested in learning HTML, CSS, and PHP. The components library, combined with the theme selection, delivers a good starting point for those who are on a time crunch or don’t feel like beginning from scratch.

5. TextMate

TextMate comes offered as a free download, but you can also decide to upgrade to the premium version for $59. Keep in mind that this payment only gets you one license, so you would have to pay for multiple seats if you have a whole team of people in need of the text editor.

To get started, TextMate strictly works on the macOS. It seems like a simple editor at first, but it actually has quite a bit of functionality crammed into a small package. Some of the standards you would expect from a text editor include find search and replace tools, autocompletion, and board management. All programming languages are supported by TextMate, and it does have a tool for Xcode projects.

TextMate text editor

TextMate text editor

TextMate lets you create multiple insertion points for editing and swapping out pieces of code in bulk. You also receive a list of all version modifications. So, the list includes file changes and allows you to jump back in time if needed.

Which Features Make This One of the Best Text Editor Tools?

  • TextMate comes with free and paid versions, both of which provide excellent features.
  • It’s a lightweight text editor with a clean interface.
  • TextMate offers bundles so that you can customize almost every element in the text editor. Want to change languages? That’s possible. Want to adjust your workflows? Go for it.
  • You have the option to generate macros to speed up your production processes. All of your repetitive work is eliminated with these macros.
  • An advanced file searching tool is included, along with multiple carets for swapping and adjusting multiple lines of code all at once.

If you’re using a Mac, and would like a text editor that supports all coding languages, TextMate is a solid choice for you. It also appears to be a nice solution for those who like bundles and macros.

6. Vim

With support for Windows, Linux, and Mac, the Vim text editor is a stable, reliable editor that integrates with many popular tools. It’s designed for use both from a command-line interface (CLI) and as a standalone application in a graphical user interface (GUI).

Vim was created in 1991. Back then, it was considered one of the most prominent text editors, which allowed developers to generate updates and scripts with a series of commands. This makes it one of the oldest text editors, and it’s quite impressive that Vim is still being used by developers around the world.

Vim text editor

Vim text editor

It’s worth noting that Vim is one of the most advanced text editors on this list. However, that doesn’t mean it’s the most user-friendly. Vim definitely requires a learning curve and a willingness to immerse yourself in a whole new feature-set that might not be the same as some other text editors you are used to.

Having said that, you can expect a strong search and replace functionality, along with a large collection of plugins to extend the feature-set in this text editor. We also like the fact that Vim has a large online community to trade tips and learn about new tools to expand upon the base text editor.

You’ll probably notice just how archaic the Vim website looks. Well, the interface for the text editor isn’t much different. That being said, it’s still a high-powered solution for your text editing needs.

Which Features Make This One of the Best Text Editor Tools?

  • Vim provides a system that’s friendly for people who enjoy using plugins for expanding upon the text editor.
  • The Vim online community is a place for learning more about extensions as well as new scripts, tips, and tools.
  • It is completely free and is an open source solution that receives updates on a regular basis.
  • It’s also one of the oldest text editors on the market, and it continues to have some of the most powerful features and a strong following.
  • You can integrate Vim with several tools that you are already using for your business or design needs.
  • It doesn’t matter what programming languages you’re using, because Vim supports hundreds of languages, along with several different types of file formats.
  • With the open source nature of Vim, and the vibrant community, you can vote for new features and really make an impact on the future development of the text editor.
  • You can utilize the text editor on all of your machines, since it works on Linux, Windows, and Mac. There are popular projects like MacVim which provide a better GUI.

It’s tough to say which developers would enjoy Vim as a text editor. It’s an old system with an outdated interface. Yet, it still has the charm and powerful feature-set that the average developer needs. I would recommend it to more advanced developers who enjoy using open source software and being a part of a community–like the one you can find behind Vim.

Nano is another popular alternative to Vim used by developers.

7. UltraEdit

UltraEdit also serves as a viable solution for your text editing needs. It’s not free. In fact, you have to start by paying at least $99.95. That gets you the standard UltraEdit text editor, along with free upgrades for any future releases. You can also install the software on three machines, whether it’s Windows, Mac, or Linux computers.

After that, there are plenty of upgrades and additions to UltraEdit, such as an FTP program, compare tools, and finder options. You can decide whether or not any of these will help with your work process, but each one of them requires an additional payment. As for the core text editor, UltraEdit is known for its performance and customization abilities, along with some nice-looking themes so that you don’t always have to start from scratch. You can replace and find files, and most of the tasks like these are done in a rapid fashion.

UltraEdit text editor

UltraEdit text editor

The multi-caret selection tool is sure to speed up development by allowing you to delete, paste, and cut anything you would like with the selection from your cursor. Live previews are also available. They’re displayed side-by-side as you make markdown changes right next to the preview. The feature set from UltraEdit is one of the most comprehensive on this list, so we can’t cover them all. However, we do particularly enjoy the customizable user interface, which allows you to lay out your workspace however you’d like.

Which Features Make This One of the Best Text Editor Tools?

  • UltraEdit is a premium solution that provides customer support, a decent community, and a wide variety of features that you wouldn’t always get with a free or open source text editor.
  • It’s one of the fastest text editors you’ll find, especially in terms of replacing and finding files and selecting and editing multiple bits of code.
  • The HTML live preview brings a visual aspect to your programming process. It sits right next to the text editor and renders an HTML preview for you to see right in the program.
  • You’re able to edit extremely large files with UltraEdit. Many times, you’ll find that a less powerful or free text editor will crash when you try to customize these large files. That’s not the case with UltraEdit.
  • This is a multiplatform text editor, and when you pay for one license you can use it on three different machines.
  • All the tools are configurable in the text editor. You can even choose from some editor themes that serve as skins for the program.
  • There are several smart templates that automatically complete some of the code as you type.

UltraEdit serves a few purposes. First of all, it allows developers and programmers an option for uploading and editing large files. You’ll also notice that it has incredible power and performance for locating files and searching for areas in those files. We also like it for corporate use, seeing as how you can install it on three different platforms and it’s one of the more secure and trusted solutions on the market. From regular text editing to web development and file comparing, UltraEdit provides an impressive set of key features that come at a reasonable price.

8. Coda

Coda is for all the Mac lovers out there. It costs $99 for one copy, and the pricing gets progressively cheaper per copy if you purchase multiple copies at the same time. In addition, Coda is very reminiscent of many other Mac products, in that it has one of the most beautiful interfaces of every text editor on the market today. Mac users rave about it, and it’s not hard to see why. First of all, you receive a built-in terminal and an inspector to go along with an interface that lets you edit both remote and local files.

Coda text editor

Coda text editor

Coda is also an elder in this space, seeing as how it’s been around for over a decade. Coda2 is actually the text editor that you would be installing on your computer. This version offers some unique features such as local indexing and a CSS override for editing CSS on a live website. Another notable new feature is the publishing tool that tracks all of your files outside of the Coda app. You can then save and publish any of these remote files directly into the text editor.

On the surface, Coda is a basic text editor with features for syntax highlighting, code folding, and autocompletes. However, you will find some rather unique editing options, like something called a wildcard token that lets the user rapidly generate items like gradients and colors as you type. Although the text editor goes for $99, you receive a great value, along with excellent customer support and plenty of free e-books and resources dedicated just to the Coda editor.

Which Features Make This One of the Best Text Editor Tools?

  • Coda provides a one-click wildcard token for adding little changes throughout your document when working through the find and replace tool.
  • It offers one of the cleanest, most modern interfaces out of all text editors.
  • You receive excellent basic tools for working with a wide variety of languages and highlighting syntax.
  • It is designed specifically for Mac users, so it’s great if you love Macs.
  • File management is a breeze on Coda, seeing as how you can edit remotely through FTP or Amazon S3 servers, or even access your local files and publish them remotely.
  • Much of your coding is completed through the text editor on your desktop. However, you can remotely edit your code, or even test out previews on your iPhone or iPad while editing in Coda.
  • The new version includes some revolutionary tools such as CSS overriding, Panic syncing for passwords and private keys, and local indexing to autocomplete anything from classes to functions.

If you want the most beautiful interface on this list, this is the text editor for you. It’s also important to remember that this is one of the few text editors made just for Mac computers. So, if you’re a Mac user, it makes sense to go with Coda. You also might consider it if you would like to improve your coding previews or need to figure out a way to edit your files both remotely and locally.

9. BBEdit

BBEdit is an editor that spawned from the same technology used in TextWrangler. Now that TextWrangler has been decommissioned, all of its users are being pushed to use BBEdit instead.

Similar to Coda, BBEdit is also exclusively used on the Mac operating system. It offers highly advanced features, but also strives to have a bare-bones like appearance to go along with the acronym BB. BBEdit includes excellent features like Git integration and auto-completion. Syntax highlighting and quick lookups are also provided, along with editing windows that you can split up and place next to each other for easier editing. The current version of BBEdit costs $49.99 for an individual license. You can also upgrade to new versions for cheaper prices.

BBEdit text editor

BBEdit text editor

With BBEdit, you have complete control over the text in your editor, it’s extremely easy to search and locate items due to the clean interface and smooth workflows. Text handling is one way to use BBEdit, seeing as how it offers excellent features such as canonization, hard wraps, and case changes. You’ll also find this text editor useful for web development, with its powerful previews in any browser and the ability to add special characters to any HTML.

Struggling with downtime and WordPress problems? Kinsta is the hosting solution designed to save you time! Check out our features

The BBEdit text editor has impressive options for programming as well. For instance, many programmers enjoy the ability to auto-indent and check their syntax for certain scripts like Python and Ruby. We also like the fact that this text editor has code folding so that you can read your files easier by hiding larger sections of code. Overall, BBEdit is one of the best text editors, especially for those who are already using the Mac operating system.

Which Features Make This One of the Best Text Editor Tools?

  • BBEdit features code folding and text completion, both of which make for a cleaner interface and speedier coding.
  • It works with a wide variety of languages and has syntax checking for multiple scripts.
  • You receive a bare-bones interface that is meant to clear out all distractions while still keeping around the features that make for a strong text editor.
  • This text editor is created just for Mac users, so you won’t have to worry about getting used to a new interface.
  • Search and replace tools are available for adjusting individual items throughout multiple files. There are also several navigation functions as well as syntax coloring.
  • You can add special characters to your code and insert attributes and tags that might assist you while writing your HTML.
  • Under construction HTML and markdown can be previewed right next to the code being edited. Not only that, but all updates you make to the code are automatically changed in the preview before your eyes.
  • It offers automated completion tools for suggesting things like clippings and symbols.
  • You can take advantage of basic and more advanced text handling features such as the ability to exchange characters and words, the straightening of quotes, and full canonization.
  • All of your projects have folder listings so that you can organize your work and then browse and edit your directory listings with speed and precision.
  • All files can be accessed and manipulated through SFTP and FTP.

BBEdit works wonders for those on the Mac operating system. It has the tools you need for web development, along with text handling. So, you might use it if you’re a writer or a programmer. It’s also worth noting that with the fairly low price and incredibly clean interface, it might make more sense to go with BBEdit over Coda.

10. Komodo Edit (Or IDE)

The idea behind Komodo Edit is to offer something powerful, yet with a certain level of simplicity, so that even beginners should be able to grasp it. You can download Komodo Edit for Mac or Windows operating systems. It’s free and open source, allowing those who don’t need all the advanced features a text editor that gets smaller projects done.

Also, if you require more advanced tools like code profiling or unit testing, the Komodo IDE upgrade does the trick. Support for all languages and frameworks is provided through Komodo IDE, making it ideal for web development. Also, this upgrade doesn’t cost you anything since it’s also an open source project.

Komodo Editor text editor

Komodo Editor text editor

However, I would recommend trying out Komodo Edit first to see if it has all of the tools you need for projects. After all, it’s a cleaner interface and lighter weight solution for keeping projects better organized. Komodo IDE has all of the features from Komodo Edit but then it adds on dozens more. For instance, both offer things like the multi-language editor, skin sets, and the ability to make multiple selections.

However, you would have to switch to the Komodo IDE text editor if you need print debugging, or if you’d like tutorials for learning about the system.

Which Features Make This One of the Best Text Editor Tools?

  • Komodo Edit is one of the best text editor options since it offers two separate versions, one that’s great for light users and another that’s for the advanced power user.
  • Both of the versions, including Komodo Edit and Komodo IDE, can be downloaded for free.
  • The Komodo IDE version has real-time code collaboration tools for connecting with other developers on your team and sharing and editing files together.
  • The interactive shells in Komodo IDE include Python, Ruby, and Perl.
  • The Komodo IDE option also has plenty of integrations. Some of these are Gulp, Grunt, Yarn, and Vagrant.
  • The live previewing in Komodo IDE ensures that you can render HTML visuals while adjusting your code.
  • The Komodo Edit version has the ability to track changes and make multiple selections.
  • Both versions have multi-language editors that include skin and icon sets.

When you think about it, Komodo makes solutions for everyone. Since Komodo Edit and Komodo IDE are both offered for free, less experienced and advanced users can take advantage of the text editor. So, if you’d like a lightweight version, or just something simpler, go with Komodo Edit. If you’re looking for more ambitious tools, the Komodo IDE text editor provides everything from print debugging to custom workspaces.

11. Visual Studio Code

As one of the younger players in the game (launched in 2015) Visual Studio Code puts forth quite an effort for building a stable community and ensuring that users are getting the features they need. The hard work definitely shows, since the plugin library has been growing quite a bit. It’s also an open source project that you can download directly to macOS, Windows, or Linux for free.

A few distinct areas make Visual Studio Code an appealing text editor for all developers. First of all, Visual Studio Code is often considered to be faster than older editors on the market. You can also clear out all of the clutter by opting for the Zen Mode, which removes all menus and items that don’t involve your editor.

Visual Studio Code text editor

Visual Studio Code text editor

We also enjoy the IntelliSense feature, which takes syntax highlighting and auto-completion to the next level–with the help of smart completions based on function definitions and other items like variable types. The Visual Studio Code editor has Git commands programmed into the system. This way, you’re able to pull or push from all hosted SCM services.

Finally, the Visual Studio Code website has numerous tabs for you to learn about the software. The documentation page walks you through steps like the setup and working with different languages. You’re also able to check out some tips and tricks and learn all of the Visual Studio Code keyboard shortcuts. Along with a blog, updates page, extensions library and API information, Visual Studio Code looks like a great choice.

Which Features Make This One of the Best Text Editor Tools?

  • Visual Studio Code is a completely free text editor with open source access and a large collection of extensions to make some upgrades.
  • The community is strong and the website includes plenty of documentation, a full blog, and lots of information in the form of FAQs and API page.
  • It provides built-in Git commands.
  • The IntelliSense feature does a wonderful job of upgrading the standard autocomplete and syntax highlighting features you would expect from most text editors. Essentially, it creates smart completions based on items like function definitions and variable types.
  • You have the option to debug your code directly in the editor. Therefore, there is no reason for print statement debugging.
  • This is a multiplatform text editor, with support for Linux, Mac, and Windows.

There are a few reasons you might consider Visual Studio Code for your text editing needs. The first is if you would like a free text editor that actually has a thriving community behind it. The second reason would be if you like the idea of extending and customizing your text editor in terms of language, theme, and debugger support. We also really like the IntelliSense feature, so it makes sense for people who are also intrigued by the smart completions.

Looking for a cool Visual Studio Code theme? Check out Shades of Purple, created and maintained by Ahmad Awais.

12. Brackets

The Brackets text editor comes from the folks at Adobe, in an attempt to offer a more modern, open source solution for developers creating websites. This is a free text editor, with some appealing visual tools for previewing your work and allowing for frontend developers to examine the changes. Writing code is the main focus in Brackets, and it’s done with the help of inline editors, live previews, and nicely organized files.

Because of its affiliation with Adobe, Brackets has somewhat of an integration with Photoshop, in that it can take pieces of your PSD file and generate code for your project.

Brackets text editor

Brackets text editor

Brackets is open source and offers a decent community. It’s also available on Mac, Linux, and Windows machines. The interface is fairly simplistic, but the text editor has a wide range of features for you to play around with. In addition, developers are able to upload their own extensions via GitHub. If you would like to use one of these extensions, all you have to do is go to the website.

Which Features Make This One of the Best Text Editor Tools?

  • Brackets delivers on value and its feature-set, especially considering you don’t have to pay a dime and it’s specifically designed for web developers.
  • It has somewhat of an integration with PSD files.
  • The text editor connects with GitHub.
  • Several extensions are provided for you to expand upon the current text editor and potentially customize what your interface looks like.
  • Brackets is a cross-platform solution for use on all of your operating systems.
  • The live preview feature ensures that all developers can see their work in a more visual manner.
  • The inline editors let you select an area inside of your code and open a window right in the editor. This way, you don’t have to have several tabs open while completing your work.

Brackets has plenty of features to consider, but it seems like developers will most enjoy the visual live previews–considering you can’t get this type of presentation in most text editors. It’s also nice for those who want a good value for a free text editor, considering the extensions and overall community vibe is strong.

13. CodeShare

The CodeShare text editor takes a completely different approach to online code editing. It’s built for developers, and it has a focus on giving these developers the opportunity to share code in real time and speak to each other through a video chat. So, essentially it’s a real-time code editor combined with a Skype-like communication service.

The reason we like this configuration so much is because the development teams no longer have to be in the same room to see and edit changes right before their eyes. This is highly beneficial for interviews, considering you could remotely hire someone and see their coding abilities along with their face. You also might use it for a debugging session or to review any type of code for your organization.

Codeshare

Codeshare

Keep in mind that any code written on CodeShare is only stored in the text editor for 24 hours. It’s then deleted. So, you either have to save it to your own machine or you have to sign up for an account at CodeShare. A sign-up is not technically required but it does give you that huge feature of saving your code.

Other than that, there is no fee to get started with CodeShare. All you have to do is create an account and then you receive access to the video chat functionality as well as the real-time coding.

Which Features Make This One of the Best Text Editor Tools?

  • CodeShare stands out as the very first text editor to offer real-time sharing.
  • This is also one of the best text editors because it has an integrated video chat solution for logging in multiple members of your team. This might come in handy for interviews or team sessions where seeing a person’s face and hearing their voice would be beneficial.
  • It’s a completely free text editor.
  • CodeShare is a fairly bare-bones code editor, making it perfect for those who like fewer distractions.
  • Your code can be saved if you sign up for a free account.

First of all, Codeshare is made primarily for developers. So, it really doesn’t make sense to use it if you are a content creator or publisher. That said, Codeshare should be considered if you like the idea of having a video chat embedded into your online code editor. You don’t necessarily have to always use the video editor, but it is there as a feature. It’s also worth looking into if you want one of the best real-time code sharing solutions on the market. Overall, we would recommend it for those who would like to code with their teams, interview developers, or teach other people how to program through video.

Summary

If you’re still a little confused about which text editor to choose, here’s a list of our final recommendations (remember, we recommend trying each of them out to find the one that works best for your workflow):

  • Sublime Text – This one makes the most sense for heavy coders. Is lightweight with low resource usage.
  • Atom – We like Atom for people who also want a collaboration tool with the text editor.
  • Notepad++ – Consider this text editor if you’re a beginner or advanced user. It has the features developers need without being too confusing for those just starting out.
  • CoffeeCup HTML Editor – If you’re learning coding languages, think about trying this editor.
  • TextMate – Consider TextMate if you have a Mac and need support for all languages.
  • Vim – Use Vim if you’re an experienced developer who might enjoy an older interface or prefer something via the command line.
  • UltraEdit – If you need to upload and edit large files, UltraEdit does the trick.
  • Coda – Go with Coda if you’re using a Mac and would like an incredibly pretty interface.
  • BBEdit – This one is also good for Mac users.
  • Komodo Edit – You can use Komodo as a beginner or experienced pro. Just make sure to download the right version depending on which one you are.
  • Visual Studio Code – Here’s a text editor with a unique auto-completion feature. Try it out if that sounds interesting to you.
  • Brackets – Try out Brackets if you like live previews and extensions.
  • CodeShare – Consider CodeShare if you’re a developer or teacher who could use real-time code sharing and a video chat component.

Now that we’ve taken a look at some of the best text editors, share your thoughts in the comments below. Let us know if you’ve used any of these options and what your favorite feature is. Also, mention any other editors that we might have missed.

The post 13 Best Text Editors to Speed up Your Workflow appeared first on Kinsta Managed WordPress Hosting.

What’s New in WordPress 5.1 (Moving PHP Forward)

WordPress 5.1 “Betty” was officially released on February 21, 2019, and is available for download.

WordPress 5.1 is the first major release since the launch of the WordPress block editor (AKA Gutenberg) in WordPress 5.0. And while it does bring some tweaks and improvements for the block editor, the biggest new features in this release involve the WordPress Site Health project and notices for PHP versions.

In this post, we’ll take a look at all of the new features that might affect how you use WordPress:

Still looking for that perfect WordPress host?

Try Kinsta’s premium managed WordPress hosting to experience your site without problems.
  • Styleized controls representing management Fully managed
  • Shield with a tick representing securitySecure like Fort Knox
  • Merging lines representing migrationsFree migrations
  • Three right chevrons representing server speedUltimate speed
  • Circular arrow with center dot representing backupsDaily backups
  • Offset hexagons representing our server stackGoogle Cloud Platform
Check out our plans

  • New dashboard notice for PHP version
  • PHP version compatibility checks for plugins and themes
  • White screen of death protection
  • Improved block editor performance
  • Changes for developers

latest versions of PHP for improved performance and security.

From our benchmarks, PHP 7.3 is on average 9% faster than PHP 7.2. And If you compare PHP 7.3 to PHP 5.6, it can handle almost 3x as many requests (transactions) per second! You should always test your plugins and themes first on a staging site for compatibility. If all is good, make sure to take advantage of this free performance boost.

WordPress is now finally getting on board with pushing the latest versions of PHP with some new tools and notices to promote PHP versions and compatibility.

First up, if you’re running an outdated version of PHP on your server with WordPress 5.1, you’ll see a new dashboard widget prompting you to upgrade your PHP version.

WordPress 5.1 PHP version dashboard prompt

WordPress 5.1 PHP version dashboard prompt

If you host at Kinsta, there’s zero chance you will see this message because the minimum PHP version that we allow is PHP 5.6. Right now, the warning will only trigger for PHP versions under that.

We wish the WordPress team had gone with a higher version, but this is a step in the right direction. Also, if you click on the button to “Learn more about updating PHP” in the notice, the official WordPress docs do recommend PHP 7.3. 👏

minimum PHP version required as a comment in the plugin header. However, up until now, this hasn’t done anything but show what minimum PHP version the developer is willing to support.

In WordPress 5.1, if you try to install a new plugin or theme from WordPress.org where the developer has set a minimum PHP version higher than the version on your server, you’ll see a message telling you that “This plugin doesn’t work with your version of PHP. Learn more about updating PHP.”

Additionally, you will be prevented from installing the plugin. At this time, you can get around this by manually downloading the ZIP file from the repository and installing a plugin that way. But really – just update your PHP version!

PHP compatibility check for plugins

The PHP compatibility check for plugins

WordPress white screen of death while updating PHP.

Unfortunately, this feature was been pulled from the WordPress 5.1 release at the last minute. However, it’s for good reason.

The fatal error protection mechanism explained here has been pulled out of the 5.1 release as it had several flaws critical enough to postpone the feature. A new path to address the issues is underway via #46130 and is intended to be released as part of WordPress 5.2.
Felix Arntz
Felix Arntz, WordPress Core Team
make.wordpress.org

With this protection, WordPress will recognize when a fatal error occurs and pause the offending theme or plugin in the WordPress admin dashboard so that you’ll still be able to log into the backend of your site and (hopefully) fix the problem. For less tech-savvy users, this will be a great new feature once they iron out all the problems.

If your site experiences issues while upgrading PHP versions, it will look like below on the front-end, but you should still be able to log into the backend to fix the problem.

Fatal error protection in WordPress 5.1

Fatal error protection in WordPress 5.1

Gutenberg block editor in WordPress 5.0, the Gutenberg team has been hard at work improving the block editor. If you remember from our annual PHP benchmarks, we found that WordPress 5.0 and 5.02 were actually slower than WordPress 4.9.8. That’s not good! Best rest assured, the WordPress core team is working on this.

There was a bit of confusion as the Gutenberg team released Gutenberg 5.1 at the same time as the core team released WordPress 5.1.

Despite the identical version numbers, WordPress 5.1 does not include Gutenberg 5.1. Instead, WordPress 5.1 includes Gutenberg 4.8.

As such, the biggest changes to the block editor in WordPress 5.1 deal with performance. Compared to WordPress 5.0, you should see faster load times in the editor and a shorter KeyPress event time.

There’s more good news, too. The block editor performance will get even better once the most recent versions of Gutenberg are merged into the core – you can see a performance comparison of different Gutenberg versions below (remember – WordPress 5.1 includes Gutenberg 4.8 – so that’s where we’re at right now).

Struggling with downtime and WordPress problems? Kinsta is the hosting solution designed to save you time! Check out our features
Gutenberg performance benchmarks for different versions

Gutenberg performance benchmarks for different versions

Learn more.

Cron API

The Cron API now has new functions to help with returning data. You’ll also get new filters to modify cron storage. Learn more.

New JavaScript Build Processes

WordPress 5.1 offers a new JavaScript build option. You can learn more about the specific tweaks here.

How to Update to WordPress 5.1

Since every customer’s site is different we always recommend utilizing the one-click staging environment. You can clone your live site in a matter of seconds and then test WordPress 5.1 with your existing theme and plugins to check for compatibility. You can of course also take a manual backup before updating your live site, just to be safe.

To update WordPress to 5.1 simply click on the updates icon in your WordPress admin dashboard. And click on the “Update Now” button. While your site is being updated, it will be in maintenance mode. As soon as your updates are complete, your site will return to normal.

How to update to WordPress 5.1

How to update to WordPress 5.1

As long as everything goes well with the update you should then see the “What’s New” screen. And that’s it! Quick and easy.

The WordPress 5.1 welcome screen

The WordPress 5.1 welcome screen

Troubleshoot Issues with WordPress Update

Whenever people update a major version of WordPress, there are always some that experience issues, and that is due to the thousands of different plugins and themes currently co-existing in the market. Here are a few ways to troubleshoot common issues.

  • Getting the white screen of death? This is commonly resolved by simply restarting PHP and deleting the full page cache on your WordPress site.
  • Try deactivating all your plugins to see if that fixes your issue. Then reactivate them one by one until you find which plugin might need an update from the developer.
  • Try switching over to a default WordPress theme, such as Twenty Nineteen. If this fixes your problem, you might want to reach out to your theme developer.
  • Troubleshoot and diagnose JavaScript issues in your browser.

Summary

While there aren’t any big front-facing features in this release, WordPress 5.1 adds some great features to push for healthier WordPress sites.

The focus on PHP versions will hopefully push the large percentage of WordPress users running out-of-date PHP versions to update to more recent versions, and the block editor performance improvements are much welcomed.

What do you think of WordPress 5.1? Does anything catch your eye? Anything you wish they would’ve included?

The post What’s New in WordPress 5.1 (Moving PHP Forward) appeared first on Kinsta Managed WordPress Hosting.

The Definitive PHP 5.6, 7.0, 7.1, 7.2 & 7.3 Benchmarks (2019)

Each year we release our in-depth performance benchmarks across various platforms to see how different versions of PHP stack up against each other. This time we again went all out and benchmarked five different PHP versions across 24 different platforms/configurations; including WordPress (both 4.9 and 5.0), Drupal, Joomla!, Laravel, Symfony, and many more. We also tested popular ecommerce solutions such as WooCommerce, Easy Digital Downloads, Magento, Grav CMS, and October CMS.

We are always encouraging WordPress users to take advantage of the latest supported versions of PHP. Not only are they more secure, but they offer additional performance improvements. We aren’t talking just about WordPress either, this true for the most part across all platforms. We’ll show you today how PHP 7.3 knocks the socks off of everything we put it against! 🤘

So Long HHVM, 2019 Is the Year of PHP

PHP is an open-source, server-side scripting and programming language that’s primarily used for web development. The bulk of the core WordPress software is written in PHP, which makes PHP a very important language for the WordPress community. Although the new block editor in WordPress 5.0 has introduced more JavaScript with React.

Still looking for that perfect WordPress host?

Try Kinsta’s premium managed WordPress hosting to experience your site without problems.
  • Styleized controls representing management Fully managed
  • Shield with a tick representing securitySecure like Fort Knox
  • Merging lines representing migrationsFree migrations
  • Three right chevrons representing server speedUltimate speed
  • Circular arrow with center dot representing backupsDaily backups
  • Offset hexagons representing our server stackGoogle Cloud Platform
Check out our plans

According to W3Techs, PHP is used by over 78% of all the websites who use a server-side programming language. Some may argue that PHP is dead. But even though developers like to state this, PHP is alive, faster, and better than ever.

In our 2016 benchmarks, HHVM was the clear winner in terms of performance when it came to running WordPress. HHVM was created by the team over Facebook. It’s a system that uses just-in-time (JIT) compilation to convert PHP code into a machine language to establish a synergy between the PHP code and the underlying hardware that runs it. We used to offer HHVM at Kinsta as another alternative, due to the fact that PHP wasn’t keeping up in terms of improvements.

However, in our 2017 benchmarks, PHP 7.2 took a slight lead across almost all platforms, beating out HHVM for the first time (the more requests the better):

  • WordPress 4.9.4 PHP 7.2 benchmark: 148.80 req/sec 🏆
  • WordPress 4.9.4 HHVM benchmark: 144.76 req/sec
  • WordPress 4.9.4 + WooCommerce 3.3.1 PHP 7.2 benchmark: 92.60 req/sec 🏆
  • WordPress 4.9.4 + WooCommerce 3.3.1 HHVM benchmark: 69.58 req/sec

Therefore, as of August 28th, 2018 Kinsta stopped offering HHVM. One, because it’s no longer a stable option for WordPress, and second because it no longer supports PHP as of v3.30. You can read more about this in our farewell to HHVM.

This is actually great news for developers and end-users alike as it means more of a focus back on PHP and providing faster websites and web services for everyone. Therefore, this year’s benchmarks are all about PHP!

Below you’ll get to see how the newest version, PHP 7.3 (released on December 6th, 2018) performs, as well as WordPress 5.0 (ironically also released on December 6th, 2018).

PHP Benchmarks (2019)

For each test, we used the latest version of each platform and benchmarked the home page for a minute with 15 concurrent users. Below are the details of our test environment.

  • Machine used: 8x Intel(R) Xeon(R) CPU @ 2.20GHz (Powered by Google Cloud Platform and running in an isolated container)
  • OS: Ubuntu 18.04.1 LTS (Bionic Beaver)
  • Docker Stack: Debian 9, Nginx 1.15.7, MariaDB 10.3.11
  • PHP Version: 5.6, 7.0, 7.1, 7.2, 7.3
  • Page Caching: Disabled on all configurations and platforms.
  • OPCache: For WordPress, Joomla, and Drupal, we used the official Docker image and we created our own for PHP 7.3 (Dockerfile). For the rest we used the same image setup with the OPcache enabled using the following recommended php.ini settings, except for the opcache.max_accelerated_files value which was increased from 4,000 to 50,000.
opcache.memory_consumption=128 opcache.interned_strings_buffer=8 opcache.max_accelerated_files=50000 opcache.revalidate_freq=60 opcache.fast_shutdown=1 opcache.enable_cli=1

OPcache improves PHP performance by storing precompiled script bytecode in shared memory, thereby removing the need for PHP to load and parse scripts on each request.

The tests were performed by Thoriq Firdaus a WordPress contributor and support engineer here at Kinsta. He’s contributed to WordPress Core and Translation Editor for WordPress Indonesia.

Platforms and Configurations Tested

Our tests include the following 24 platforms/configurations. On some, we had to test multiple versions due to the lack of support for a specific PHP version. Click on one below to skip directly to its test notes and results. The data is measured in requests per second. The more requests the better.

  • WordPress 5.0
  • WordPress 5.0 + WooCommerce 3.5.2
  • WordPress 5.0 + Easy Digital Downloads 2.9.9
  • WordPress 5.0.2
  • WordPress 4.9.8
  • WordPress 4.9.8 + WooCommerce 3.5.2
  • WordPress 4.94 + Easy Digital Downloads 2.9.9
  • Drupal 8.6.4
  • Joomla! 3.9.1
  • Magento 2 (CE) 2.1.15 + 2.3.0
  • Grav CMS 1.5.5
  • October CMS 1.0.443
  • Laravel 5.4.36 + 5.7.15
  • Symfony 3.3.6 + 4.2.0
  • CodeIgniter 3.1.9
  • PyroCMS 3.5.3
  • Pagekit 1.0.15
  • Bolt CMS 3.6.3
  • Anchor CMS 0.12.7
  • Craft CMS 3.0.35
  • ExpressionEngine 5.0.2

Due to the fact that demo content across each platform can vary dramatically, we made the decision to test the raw performance of fresh barebone installations.

WordPress 5.0

The first platform we tested was, of course, one of our favorites: WordPress (we might be a little biased being that we live and breath this CMS on a daily basis 😉). At its core, WordPress is open-source software you can use to create a beautiful website, blog, or app. In fact, WordPress powers over 32% of all the websites on the internet. Yes – more than one in four websites that you visit are likely powered by WordPress.

WordPress CMS

We started with WordPress 5.0 as that is the version you’re probably all interested in at the moment.  We used the new Twenty Nineteen theme (1.0), and benchmarked the site for a minute with 15 concurrent users.

  • Tested URL: /hello-world/
  • Note: The page contains 1 comment.
  • Docker Image is derived from https://hub.docker.com/_/wordpress/ and we created our own for PHP 7.3 (Dockerfile).
WordPress 5.0 PHP benchmarks

WordPress 5.0 PHP benchmarks

Embed on your site:

Benchmark Results

  • WordPress 5.0 PHP 5.6 benchmark: 91.64 req/sec
  • WordPress 5.0 PHP 7.0 benchmark results: 206.71 req/sec
  • WordPress 5.0 PHP 7.1 benchmark results: 210.98 req/sec
  • WordPress 5.0 PHP 7.2 benchmark results: 229.18 req/sec 
  • WordPress 5.0 PHP 7.3 benchmark results: 253.20 req/sec 🏆

PHP 7.3 was the winner, proving to be faster than PHP 7.2. And if you compare PHP 7.3 to PHP 5.6, it can handle almost 3x as many requests (transactions) per second!

WordPress 5.0 + WooCommerce 3.5.2

WooCommerce is a fully customizable, open-source ecommerce platform built for WordPress. It’s also by far, one of the most popular ecommerce solutions in the WordPress community, and currently powers over 14% of all ecommerce sites on the internet.

WooCommerce

For this next test, we took WordPress along with WooCommerce installed. We utilized the free Storefront eCommerce theme (2.4.1).

  • Tested URL: /product/woo-logo/
  • Note: The page contains 3 related products, 1 product reviews/comments, 1 product in “You May Also Like” section, product next-n-prev pagination.
  • Docker Image is derived from https://hub.docker.com/_/wordpress/ and we created our own for PHP 7.3 (Dockerfile).
WordPress 5.0 + WooCommerce PHP benchmarks

WordPress 5.0 + WooCommerce PHP benchmarks

Embed on your site:

Benchmark Results

  • WordPress 5.0 + WooCommerce 3.5.2 PHP 5.6 benchmark results: 24.74 req/sec
  • WordPress 5.0 + WooCommerce 3.5.2 PHP 7.0 benchmark results: 56.94 req/sec
  • WordPress 5.0 + WooCommerce 3.5.2 PHP 7.1 benchmark results: 57.00 req/sec
  • WordPress 5.0 + WooCommerce 3.5.2 PHP 7.2 benchmark results: 63.10 req/sec
  • WordPress 5.0 + WooCommerce 3.5.2 PHP 7.3 benchmark results: 68.87 req/sec 🏆

When running WooCommerce, PHP 7.3 beat out PHP 7.2 by a small margin.

WordPress 5.0 + Easy Digital Downloads 2.9.9

Easy Digital Downloads (EDD), created by Pippin Williamson, is a free WordPress eCommerce plugin that focuses purely on helping creators and developers sell digital products.

Easy Digital Downloads

After seeing how WooCommerce performed, we then took WordPress along with Easy Digital Downloads installed. We utilized the free EDD Starter Theme (1.0).

  • Tested URL: /downloads/sample-product/
  • Note: The page contains 3 menus in the navigation bar and an “Add to cart” widget.
  • Docker Image is derived from https://hub.docker.com/_/wordpress/ and we created our own for PHP 7.3 (Dockerfile)/
WordPress + Easy Digital Downloads PHP benchmarks

WordPress + Easy Digital Downloads PHP benchmarks

Embed on your site:

Benchmark Results

  • WordPress 5.0 + EDD 2.9.9 PHP 5.6 benchmark results: 71.74 req/sec
  • WordPress 5.0 + EDD 2.9.9 PHP 7.0 benchmark results: 169.11 req/sec
  • WordPress 5.0 + EDD 2.9.9 PHP 7.1 benchmark results: 170.08 req/sec
  • WordPress 5.0 + EDD 2.9.9 PHP 7.2 benchmark results: 187.78 req/sec
  • WordPress 5.0 + EDD 2.9.9 PHP 7.3 benchmark results: 206.88 req/sec 🏆

PHP 7.3 dominated the tests with WordPress and Easy Digital Downloads. You might also notice, EDD can handle 3x as many requests (transactions) per second when stacked up against WooCommerce! There’s no doubt that EDD is simply a faster and more lightweight solution.

WordPress 5.0.2

Since WordPress 5.0.2 was just recently released, we thought it would also be interesting to run benchmarks for 5.0.2.

WordPress CMS

We used the new Twenty Nineteen theme (1.0), and benchmarked the site for a minute with 15 concurrent users.

  • Tested URL: /hello-world/
  • Note: The page contains 1 comment.
  • Docker Image is derived from https://hub.docker.com/_/wordpress/ and we created our own for PHP 7.3 (Dockerfile).
WordPress 5.0.2 PHP benchmarks

WordPress 5.0.2 PHP benchmarks

Embed on your site:

Benchmark Results

  • WordPress 5.0.2 PHP 5.6 benchmark: 88.62 req/sec
  • WordPress 5.0.2 PHP 7.0 benchmark results: 205.06 req/sec
  • WordPress 5.0.2 PHP 7.1 benchmark results: 207.34 req/sec
  • WordPress 5.0.2 PHP 7.2 benchmark results: 219.01 req/sec 
  • WordPress 5.0.2 PHP 7.3 benchmark results: 241.27 req/sec 🏆

PHP 7.3 once again took the gold, but WordPress 5.0.2 was slightly slower than the 5.0 release.

WordPress 4.9.8

Since WordPress 5.0 was just recently released, we thought it would also be interesting to run benchmarks for 4.9.8, as many of you probably haven’t updated yet. Or you might be wondering if WordPress 5.0 is faster or slower.

WordPress CMS

We used the new Twenty Nineteen theme (1.0), and benchmarked the site for a minute with 15 concurrent users.

  • Tested URL: /hello-world/
  • Note: The page contains 1 comment.
  • Docker Image is derived from https://hub.docker.com/_/wordpress/ and we created our own for PHP 7.3 (Dockerfile)
WordPress 4.9.8 PHP benchmarks

WordPress 4.9.8 PHP benchmarks

Embed on your site:

Benchmark Results

  • WordPress 4.9.8 PHP 5.6 benchmark: 97.59 req/sec
  • WordPress 4.9.8 PHP 7.0 benchmark results: 221.42 req/sec
  • WordPress 4.9.8 PHP 7.1 benchmark results: 233.78 req/sec
  • WordPress 4.9.8 PHP 7.2 benchmark results: 250.36 req/sec 
  • WordPress 4.9.8 PHP 7.3 benchmark results: 276.31 req/sec 🏆

PHP 7.3 was the winner, proving to be faster than PHP 7.2. And if you compare PHP 7.3 to PHP 5.6, it can handle almost 3x as many requests (transactions) per second!

However, the most interesting result is that WordPress 4.9.8 is faster than WordPress 5.0. This doesn’t surprise us too much as the entire WordPress 5.0 project has been rushed. You can expect to see faster results with WordPress 5.0 as they continue to improve it.

WordPress 4.9.8 + WooCommerce 3.5.2

We also ran benchmark tests with WordPress 4.9.8 and WooCommerce 3.5.2.

WooCommerce

For this next test, we took WordPress along with WooCommerce installed. We utilized the free Storefront eCommerce theme (2.4.1).

  • Tested URL: /product/woo-logo/
  • Note: The page contains 3 related products, 1 product reviews/comments, 1 product in “You May Also Like” section, product next-n-prev pagination.
  • Docker Image is derived from https://hub.docker.com/_/wordpress/ and we created our own for PHP 7.3 (Dockerfile).
WordPress 4.9.8 + WooCommerce benchmarks

WordPress 4.9.8 + WooCommerce benchmarks

Embed on your site:

Benchmark Results

  • WordPress 4.9.8 + WooCommerce 3.5.2 PHP 5.6 benchmark results: 26.07 req/sec
  • WordPress 4.9.8 + WooCommerce 3.5.2 PHP 7.0 benchmark results: 60.37 req/sec
  • WordPress 4.9.8 + WooCommerce 3.5.2 PHP 7.1 benchmark results: 60.36 req/sec
  • WordPress 4.9.8 + WooCommerce 3.5.2 PHP 7.2 benchmark results: 63.33 req/sec
  • WordPress 4.9.8 + WooCommerce 3.5.2 PHP 7.3 benchmark results: 69.24 req/sec 🏆

PHP 7.3 beat out PHP 7.2 by a small margin. WordPress 4.8.9 with WooCommerce was also slightly faster than when running with WordPress 5.0.

WordPress 4.9.8 + Easy Digital Downloads 2.9.9

We also ran benchmark tests with WordPress 4.9.8 and Easy Digital Downloads 2.9.9.

Easy Digital Downloads

We took WordPress along with Easy Digital Downloads installed and utilized the free EDD Starter Theme (1.0).

  • Tested URL: /downloads/sample-product/
  • Note: The page contains 3 menus in the navigation bar and an “Add to cart” widget.
  • Docker Image is derived from https://hub.docker.com/_/wordpress/ and we created our own for PHP 7.3 (Dockerfile)/
WordPress 4.9.8 + Easy Digital Downloads PHP benchmarks

WordPress 4.9.8 + Easy Digital Downloads PHP benchmarks

Embed on your site:

Benchmark Results

  • WordPress 4.9.8 + EDD 2.9.9 PHP 5.6 benchmark results: 80.08 req/sec
  • WordPress 4.9.8 + EDD 2.9.9 PHP 7.0 benchmark results: 186.99 req/sec
  • WordPress 4.9.8 + EDD 2.9.9 PHP 7.1 benchmark results: 185.40 req/sec
  • WordPress 4.9.8 + EDD 2.9.9 PHP 7.2 benchmark results: 192.73 req/sec
  • WordPress 4.9.8 + EDD 2.9.9 PHP 7.3 benchmark results: 211.37 req/sec 🏆

PHP 7.3 dominated the tests with WordPress and Easy Digital Downloads. WordPress 4.9.8 with EDD was also slightly faster than when running with WordPress 5.0.

Drupal 8.6.4

Drupal is an open-source CMS popular for its modular system and strong developer community. It was originally launched in 2000 and according to W3Techs, powers 1.9% of all websites with a 5.5% share of the content management system market.

Drupal

For the Drupal benchmark, we utilized the free Bartik theme (8.6.4).

  • Tested URL: /node/1
  • Note: The page contains a title, a paragraph, and a Widget (Search). Page caching is turned off: https://www.drupal.org/node/2598914
  • Docker Image is derived from https://hub.docker.com/_/drupal/ and we created our own for PHP 7.3 (Dockerfile)
Drupal PHP benchmarks

Drupal PHP benchmarks

Embed on your site:

Benchmark Results

  • Drupal 8.6.4 PHP 5.6 benchmark results: 14.19 req/sec
  • Drupal 8.6.4 PHP 7.0 benchmark results: 30.30 req/sec
  • Drupal 8.6.4 PHP 7.1 benchmark results: 30.42 req/sec
  • Drupal 8.6.4 PHP 7.2 benchmark results: 32.59 req/sec
  • Drupal 8.6.4 PHP 7.3 benchmark results: 35.90 req/sec 🏆

When running Drupal, PHP 7.3 beat out PHP 7.2 by a small margin.

Joomla! 3.9.1

Joomla! is a free and open source CMS for publishing web content, originally released on August 17, 2005.  It’s built on a model–view–controller web application framework and according to W3Techs is used by 3.0% of all websites on the internet.

Joomla!

For the Joomla! benchmark, we utilized the free Beez3 template.

  • Tested URL: /index.php/3-welcome-to-your-blog
  • Note: Installed with “Blog” mode. Joomla modules like search, widget, and breadcrumb, are all disabled.
  • Docker Image is derived from https://hub.docker.com/_/joomla/ and we created our own for PHP 7.3 (Dockerfile)
Joomla! PHP benchmarks

Joomla! PHP benchmarks

Embed on your site:

Benchmark Results

  • Joomla! 3.9.1 PHP 5.6 benchmark results: 27.45 req/sec
  • Joomla! 3.9.1 PHP 7.0 benchmark results: 38.48 req/sec
  • Joomla! 3.9.1 PHP 7.1 benchmark results: 37.79 req/sec
  • Joomla! 3.9.1 PHP 7.2 benchmark results: 38.68 req/sec
  • Joomla! 3.9.1 PHP 7.3 benchmark results: 41.03 req/sec 🏆

On Joomla! we can see that performance was a little all over the board compared to some of the other platforms. However, PHP 7.3 was still the winner.

Magento 2 (CE) 2.1.15 + 2.3.0

Magento is a popular open-source ecommerce platform written in PHP and was released on March 31, 2008. According to W3Techs, it powers 1.0% of all websites on the internet.

Magento

For the Magento 2 benchmark, we utilized the free Luma theme. We used two versions due to the fact that 2.1.15 was the only one that supported PHP 5.6. For the additional tests, we used 2.3.0. Magento 2 does not support PHP 7.3 yet.

  • Tested URL: /index.php/lifelong-fitness-iv.html
  • Note: Page Caching is disabled. The tested URL is a single product. It contains one image product, a navigation bar, breadcrumb navigation, and no reviews.
  • http://pubfiles.nexcess.net/magento/ce-packages/
Magento 2 PHP benchmarks

Magento 2 PHP benchmarks

Embed on your site:

Benchmark Results

  • Magento 2 (CE) 2.1.15 PHP 5.6 benchmark results: 7.65 req/sec
  • Magento 2 (CE) 2.1.15 PHP 7.0 benchmark results: 16.19 req/sec
  • Magento 2 (CE) 2.1.15 PHP 7.1 benchmark results: 16.38 req/sec 🏆
  • Magento 2 (CE) 2.3.0 PHP 7.1 benchmark results: 13.60 req/sec
  • Magento 2 (CE) 2.3.0 PHP 7.2 benchmark results: 14.25 req/sec
  • Magento 2 (CE) 2.3.0 PHP 7.3 benchmark results: not supported

Magento 2 PHP benchmarks are all across the board. In fact, the older version, Magento 2 (CE) 2.1.15 along with PHP 7.1 was the fastest.

Grav CMS 1.5.5

Grav is an easy to use, yet powerful, open-source CMS that requires no database. This is also sometimes referred to as a flat-file CMS.

Grav CMS

For the Grav CMS benchmark, we utilized the free Clean Blog skeleton package.

  • Tested URL: /home/the-urban-jungle
  • Note: Content is a simple one column blog post with no sidebar.
Grav CMS PHP benchmarks

Grav CMS PHP benchmarks

Embed on your site:

Benchmark Results

  • Grav CMS 1.5.5 PHP 5.6 benchmark results: 42.62 req/sec
  • Grav CMS 1.5.5 PHP 7.0 benchmark results: 64.43 req/sec
  • Grav CMS 1.5.5 PHP 7.1 benchmark results: 63.74 req/sec
  • Grav CMS 1.5.5 PHP 7.2 benchmark results: 65.26 req/sec
  • Grav CMS 1.5.5 PHP 7.3 benchmark results: 68.34 req/sec 🏆

We can see with Grav CMS that the latest version of PHP 7.3 is the winner.

October CMS 1.0.443

October CMS is a free, open-source, self-hosted and modular CMS platform based on the Laravel PHP Framework. It was originally released on May 15, 2014.

October CMS

For the October CMS benchmark, we utilized the free Clean Blog theme. It’s important to note that October CMS is no longer compatible with PHP 5.6. Even though we were able to trick the installer by removing the PHP check, it failed with a 500 error code in the configuration wizard.

  • Tested URL: /blog/post/first-blog-post
October CMS PHP benchmarks

October CMS PHP benchmarks

Embed on your site:

Benchmark Results

  • October CMS 1.0.443 PHP 5.6 benchmark results: not supported
  • October CMS 1.0.443 PHP 7.0 benchmark results: 23.29 req/sec
  • October CMS 1.0.443 PHP 7.1 benchmark results: 22.97 req/sec
  • October CMS 1.0.443 PHP 7.2 benchmark results: 23.38 req/sec
  • October CMS 1.0.443 PHP 7.3 benchmark results: 25.58 req/sec 🏆

PHP 7.3 again is the winner, if only by a slight margin.

It’s also nice to see these smaller content management systems dropping support for older versions of PHP. Although that is one advantage of not being quite as big either. Unfortunately, when it comes to WordPress and other platforms with a large portion of the market share, things progress more slowly due to compatibility issues.

Laravel 5.4.36 + 5.7.15

Laravel is a very popular open-source PHP framework used to develop web applications. It was created by Taylor Otwell and was released in June 2011.

Laravel

For the Laravel benchmark, we used a plain HTML theme.

  • Tested URL: / (homepage)
  • The post contains, title, author name, and main content. The database contains 1 table “posts”.
  • The table contains 6 columns “post_title”, “post_content”, “post_author”, “created_at” and “updated_at”.
  • The tested URL connected to the database and showing 1 post from the database.
Laravel 5.4.36 PHP benchmarks

Laravel 5.4.36 PHP benchmarks

Embed on your site:

Benchmark Results

  • Laravel 5.4.36 PHP 5.6 benchmark results: 340.26 req/sec
  • Laravel 5.4.36 PHP 7.0 benchmark results: 610.81 req/sec
  • Laravel 5.4.36 PHP 7.1 benchmark results: 616.93 req/sec
  • Laravel 5.4.36 PHP 7.2 benchmark results: 692.86 req/sec 
  • Laravel 5.4.36 PHP 7.3 benchmark results: 717.06 req/sec  🏆

PHP 7.3 is the clear winner here. It’s also nice to a fairly regular progression with the last two versions of PHP.

It’s important to note that Laravel 5.7.15 requires PHP 7.1 or higher.

Laravel 5.7.15 PHP benchmarks

Laravel 5.7.15 PHP benchmarks

Embed on your site:

Benchmark Results

  • Laravel 5.7.15 PHP 5.6 benchmark results: not supported
  • Laravel 5.7.15 PHP 7.0 benchmark results: not supported
  • Laravel 5.7.15 PHP 7.1 benchmark results: 542.16 req/sec
  • Laravel 5.7.15 PHP 7.2 benchmark results: 606.73 req/sec
  • Laravel 5.7.15 PHP 7.3 benchmark results: 621.09 req/sec 🏆

Again, PHP 7.3 is the winner here. However, what’s interesting is that Laravel 5.4.36 with PHP 7.3 appears to be faster than Laravel 5.7.15.

Symfony 3.3.6 + 4.2.0

Symfony is a set of reusable PHP components and a PHP framework to build web applications, APIs, microservices and web services. It was released on October 22, 2005.

Symfony

Struggling with downtime and WordPress problems? Kinsta is the hosting solution designed to save you time! Check out our features

For the Symfony benchmark, we used the Symfony Demo with MySQL (they default to SQLite). Tests were run multiple times and averages were taken.

  • Tested URL: /en/blog/posts/hello-world
  • The post contains title, date, author name, 2 tags, and 5 comments.
  • The oldest symfony/demo example app we could get runs on 3.3.6, which is an unmaintained version. We included it as it’s the only symfony/demo app left that could run on PHP 5.6. The latest version could only run in 7.1 and above. The result is slightly slower compared to the last year test. This could possibly because the single page queries more tables than on the homepage (comments).
Symfony 3.3.6 benchmarks

Symfony 3.3.6 benchmarks

Embed on your site:

Benchmark Results

  • Symfony 3.3.6 PHP 5.6 benchmark results: 71.71 req/sec
  • Symfony 3.3.6 PHP 7.0 benchmark results: 155.08 req/sec
  • Symfony 3.3.6 PHP 7.1 benchmark results: 158.88 req/sec
  • Symfony 3.3.6 PHP 7.2 benchmark results: 169.78 req/sec 🏆
  • Symfony 3.3.6 PHP 7.3 benchmark results: not supported

Since PHP 7.3 isn’t supported by Symfony 3.3.6, PHP 7.2 wins here.

It’s important to note that Symfony 4.2.0 requires PHP 7.1 or higher.

Symfony 4.2.0 PHP benchmarks

Symfony 4.2.0 PHP benchmarks

Embed on your site:

Benchmark Results

  • Symfony 4.2.0 PHP 5.6 benchmark results: not supported
  • Symfony 4.2.0 PHP 7.0 benchmark results: not supported
  • Symfony 4.2.0 PHP 7.1 benchmark results: 123.64 req/sec
  • Symfony 4.2.0 PHP 7.2 benchmark results: 126.76 req/sec
  • Symfony 4.2.0 PHP 7.3 benchmark results: 140.09 req/sec 🏆

PHP 7.3 is again on top.

CodeIgniter 3.1.9

CodeIgniter is a powerful PHP framework with a very small footprint, built for developers who need a simple and elegant toolkit to create full-featured web applications.

CodeIgniter logo

  • Tested URL: / (homepage)
  • Note: The homepage contains content (title and body text) retrieved from the database table.
CodeIgniter PHP benchmarks

CodeIgniter PHP benchmarks

Embed on your site:

Benchmark Results

  • CodeIgniter 3.1.9 PHP 5.6 benchmark results: 708.31 req/sec
  • CodeIgniter 3.1.9 PHP 7.0 benchmark results: 855.08 req/sec
  • CodeIgniter 3.1.9 PHP 7.1 benchmark results: 872.79 req/sec
  • CodeIgniter 3.1.9 PHP 7.2 benchmark results: 883.88 req/sec 
  • CodeIgniter 3.1.9 PHP 7.3 benchmark results: 889.67 req/sec 🏆

As with Laravel and Symfony, PHP 7.3 was the fastest when running CodeIgniter.

PyroCMS 3.5.3

PyroCMS is an open source and essentially an extension of Laravel which allows you to build websites and applications on the framework faster.

PyroCMS

For the PyroCMS benchmark, we used the free starter theme.

  • Tested URL: /posts/welcome-to-pyrocms
  • Note: PyroCMS doesn’t support PHP 5.6. We also encountered errors when running trying to run it on PHP 7.3, most likely because it isn’t supported yet. Therefore, we weren’t able to include PHP 7.3 in the benchmarks.
PyroCMS PHP benchmarks

PyroCMS PHP benchmarks

Embed on your site:

Benchmark Results

  • PyroCMS 3.5.3 PHP 5.6 benchmark results: not supported
  • PyroCMS 3.5.3 PHP 7.0 benchmark results: 33.56 req/sec
  • PyroCMS 3.5.3 PHP 7.1 benchmark results: 34.87 req/sec
  • PyroCMS 3.5.3 PHP 7.2 benchmark results: 36.12 req/sec 🏆
  • PyroCMS 3.5.3 PHP 7.3 benchmark results: not supported

Due to the fact that PHP 7.3 isn’t working yet with PyroCMS, PHP 7.2 won the tests here by a small margin.

Pagekit 1.0.15

Pagekit is an open-source modular and lightweight CMS founded by YOOtheme. It gives you the tools to create beautiful websites. It was released in the Spring of 2016.

pagekit

For the Pagekit benchmark, we used the free One theme (default Pagekit theme).

  • Tested URL: /blog/1
Pagekit PHP benchmarks

Pagekit PHP benchmarks

Benchmark Results

  • Pagekit 1.0.15 PHP 5.6 benchmark results: 133.11 req/sec
  • Pagekit 1.0.15 PHP 7.0 benchmark results: 226.29 req/sec
  • Pagekit 1.0.15 PHP 7.1 benchmark results: 227.42 req/sec
  • Pagekit 1.0.15 PHP 7.2 benchmark results: 238.00 req/sec
  • Pagekit 1.0.15 PHP 7.3 benchmark results: 244.77 req/sec 🏆

PHP 7.3 took the gold when testing it with Pagekit.

Bolt CMS 3.6.3

Bolt CMS, or Bolt, is an open-source content management tool, which strives to be as simple and straightforward as possible. It is based on Silex and Symfony components, uses Twig and either SQLite, MySQL or PostgreSQL.

Bolt CMS

For the Bolt CMS benchmark, we used the free Bolt Base 2018 theme.

  • Tested URL: /page/hello-world
  • Note: Content generated with the built-in dummy content generator
Bolt CMS PHP benchmarks

Bolt CMS PHP benchmarks

Benchmark Results

    • Bolt CMS 3.6.3 PHP 5.6 benchmark results: 33.01 req/sec
    • Bolt CMS 3.6.3 PHP 7.0 benchmark results: 75.69 req/sec
    • Bolt CMS 3.6.3 PHP 7.1 benchmark results: 76.02 req/sec
    • Bolt CMS 3.6.3 PHP 7.2 benchmark results: 77.38 req/sec
    • Bolt CMS 3.6.3 PHP 7.3 benchmark results: 83.81 req/sec 🏆

PHP 7.3 took the gold when testing it with Bolt CMS.

Anchor CMS 0.12.7

Anchor is a super-simple, open-source and lightweight blog system, made to let you just write.

Anchor CMS

For the Anchor CMS benchmark, we used the free Default Theme by Visual Idiot.

  • Tested URL: /posts/hello-world
Anchor CMS PHP benchmarks

Anchor CMS PHP benchmarks

Benchmark Results

  • Anchor CMS 0.12.7 PHP 5.6 benchmark results: 559.02 req/sec
  • Anchor CMS 0.12.7 PHP 7.0 benchmark results: 677.48 req/sec
  • Anchor CMS 0.12.7 PHP 7.1 benchmark results: 691.45 req/sec
  • Anchor CMS 0.12.7 PHP 7.2 benchmark results: 713.37 req/sec
  • Anchor CMS 0.12.7 PHP 7.3 benchmark results: 728.96 req/sec 🏆

PHP 7.3 took the gold when testing it with Anchor CMS.

Craft CMS 3.0.35

Craft CMS is a focused content management system for developers, designers, and web professionals that blends flexibility, power, and ease of use for clients.

Craft CMS

  • Tested URL: /news/hello-world
  • Tested the demo app with https://github.com/craftcms/demo
Craft CMS PHP benchmarks

Craft CMS PHP benchmarks

Benchmark Results

  • Craft CMS 3.0.35 PHP 5.6 benchmark results: not supported
  • Craft CMS 3.0.35 PHP 7.0 benchmark results: 57.46 req/sec
  • Craft CMS 3.0.35 PHP 7.1 benchmark results: 58.81 req/sec
  • Craft CMS 3.0.35 PHP 7.2 benchmark results: 59.19 req/sec
  • Craft CMS 3.0.35 PHP 7.3 benchmark results: 59.64 req/sec 🏆

PHP 7.3 took the gold when testing it with Craft CMS.

ExpressionEngine 5.0.2

ExpressionEngine is a flexible, feature-rich content management platform that empowers hundreds of thousands of individuals and organizations around the world to easily manage their web site.

ExpressionEngine

For the ExpressionEngine benchmark, we used the default theme.

  • Tested URL: /blog/entry/super-old-entry
  • Note: The page contains a sidebar with 3 widgets (search, category list, and RSS feed link. The page also contains a breadcrumb navigation.
ExpressionEngine PHP benchmarks

ExpressionEngine PHP benchmarks

Benchmark Results

  • ExpressionEngine 5.0.2 PHP 5.6 benchmark results: not supported
  • ExpressionEngine 5.0.2 PHP 7.0 benchmark results: 53.50 req/sec
  • ExpressionEngine 5.0.2 PHP 7.1 benchmark results: 53.83 req/sec
  • ExpressionEngine 5.0.2 PHP 7.2 benchmark results: 55.23 req/sec
  • ExpressionEngine 5.0.2 PHP 7.3 benchmark results: 56.15 req/sec 🏆

PHP 7.3 took the gold when testing it with ExpressionEngine.

Upgrade to PHP 7.2 or PHP 7.3 Now at Kinsta

If the results above don’t convince you, we aren’t sure what will! Just a friendly reminder. If you’re a Kinsta client, we released PHP 7.2 back in December 2017, and PHP 7.3 is also now available. If you’re wanting to see performance improvements, you can easily change to PHP 7.2 or PHP 7.3 with a single click in your MyKinsta dashboard.

Change to PHP 7.3

Change to PHP 7.3

If you are worried about it being incompatible with a third-party plugin (which can happen), this is exactly why we have staging sites. 👍 You can test away without worrying about breaking your production site.

Takeaway From Benchmark Results

As you can clearly see from the tests above, PHP 7.3 is leading the pack when it comes to performance across all platforms.

  • PHP 7.3 was the fastest engine in 19 out of the 22 configurations tested above. And one reason isn’t wasn’t the winner across the board is simply because Magento 2, Symfony 3.3.6, and PyroCMS 3.5.3 don’t fully support PHP 7.3 yet.
  • As far as WordPress is concerned, PHP 7.3 was the fastest in all tests (stock WordPress site with 4.9.8 and 5.0, WooCommerce, and Easy Digital Downloads).
  • In many of the benchmark results, you can easily spot a pattern of increased performance with each new version of PHP that is released. This is why it’s so important to test your site, plugins, etc. and stick to a regular upgrade schedule. Your visitors and customers will thank you as they expect speed!
  • If your hosting provider doesn’t offer newer versions of PHP, perhaps it’s time you think about moving.
  • For WordPress users besides upgrading to the latest PHP version, we collected a lot more techniques which can help you to further improve website performance. See the details in our ultimate guide on how to speed up your WordPress site.

We are super excited about PHP 7.3, and hope you are too! We would love to hear your thoughts regarding our benchmarks or even experiences you’ve had once upgrading. Drop them below in the comments.

The post The Definitive PHP 5.6, 7.0, 7.1, 7.2 & 7.3 Benchmarks (2019) appeared first on Kinsta Managed WordPress Hosting.

Is PHP Dead? No! At Least Not According to PHP Usage Statistics

You’ve probably heard about how the new WordPress Gutenberg editor brings block-based editing to WordPress.

There is a change going on behind the scenes that casual users might not notice, that Gutenberg blocks are made using JavaScript (React, JSX, and ES6), not PHP. That change, along with other shifts in web development, might have you wondering, “is PHP dead?”.

So…is it? Should we call the funeral home and start the preparations? Well, first off, it’s important to point out that there’s a big difference between wanting PHP to be dead and PHP actually being dead.

Still looking for that perfect WordPress host?

Try Kinsta’s premium managed WordPress hosting to experience your site without problems.
  • Styleized controls representing management Fully managed
  • Shield with a tick representing securitySecure like Fort Knox
  • Merging lines representing migrationsFree migrations
  • Three right chevrons representing server speedUltimate speed
  • Circular arrow with center dot representing backupsDaily backups
  • Offset hexagons representing our server stackGoogle Cloud Platform
Check out our plans

People have been calling for the death of PHP for years now (you can find “Is PHP Dead?” posts as far back as 2011). And yet, PHP still persists…

In this post, we’ll dig into the data and show how PHP isn’t close to being dead (even if you really wish it were).

  • Is PHP Dead? Only if You Ignore the PHP Usage Statistics
  • PHP Is Faster and Better Than Ever, Too
  • It’s Easy to Find PHP Developers
  • You Don’t Have To Like PHP, But It’s Not Dead

Is PHP Dead? Only if You Ignore the PHP Usage Statistics

Ok, PHP might not be the best or the most modern programming language. But that doesn’t mean it’s dead, and it’s pretty tough to argue with the PHP statistics here…

First off, let’s look at what W3Techs has to say.

According to W3Techs’ data, PHP is used by 78.9% of all websites with a known server-side programming language. So almost 8 out of every 10 websites that you visit on the Internet are using PHP in some way. Which leads us to this fact…

is PHP dead?

PHP cannot die

To be fair, that number is declining. In November 2017, W3Techs had PHP as the server-side language for 80.1% of websites. That number dropped to 79.6% in June 2018, and now it’s down to 78.9% when we’re publishing this post in November 2018.

However, you also have to take some of the statistics with a grain of salt. Some of these scanning tools simply look for the X-Powered-By HTTP header. Some hosting providers, including Kinsta, remove these headers from broadcasting on the server for security purposes. Therefore, the number of sites using PHP could, in fact, be higher.

But when the number is still over 75%, it’s tough to use that decline to pronounce PHP as dead.

These numbers really shouldn’t be surprising if you think about it. First off, WordPress, the most popular content management system in existence, uses PHP. Given that WordPress powers over 32% of all the websites on the Internet, that’s a lot of sites using PHP right there.

But it’s not just WordPress, either. There are tons of other big and small sites built with PHP. For example, MediaWiki, the software behind Wikipedia, is written in PHP. And oh yeah, both Drupal and Joomla use PHP, too.

 

PHP Is Faster and Better Than Ever, Too

With the latest versions of PHP, PHP is faster than ever. Our recent PHP benchmarks show a huge performance increase for PHP 7.X over PHP 5.6.

In our tests using WordPress and popular eCommerce plugins like WooCommerce and Easy Digital Downloads, PHP 7.2 was pushing 2-3x the number of requests per second as PHP 5.6.

WordPress PHP benchmarks

WordPress PHP benchmarks

Better yet, PHP 7 also stacks up favorably against other languages, as well.

Beyond that, PHP 7.X versions also bring new improvements for developers like:

  • Combined comparison operator
  • Null coalesce operator
  • New type hinting
  • Anonymous classes
  • Nullable types
  • Iterable and void returns
  • Multi-catch exception handling
  • Keys usable in lists
  • Trailing commas
  • More negative string offsets
  • Number operators and malformed numbers
  • HTTP/2 server push

Of course, you’ll only notice these improvements if you’re actually using the latest version of PHP. Unfortunately, that’s often not the case.

According to WordPress.org, ~82.6% of WordPress sites are using PHP 7.0 or lower, with 36.9%, the plurality, using PHP 5.6:

PHP version usage for WordPress sites

PHP version usage for WordPress sites

PHP versions 7.0 and under no longer receive active support and will lose security support at the end of 2018.

The fact that so many websites are running on a PHP version that’s officially reached its end of life probably doesn’t help PHP’s reputation with developers.

Read this post if you’re still not sure why you need to update your PHP version.

It’s Easy to Find PHP Developers

Because of PHP’s popularity, it’s easy to find PHP developers. And not just PHP developers – but PHP developers with experience.

Struggling with downtime and WordPress problems? Kinsta is the hosting solution designed to save you time! Check out our features

More importantly, PHP developers themselves seem to be doing just fine, as this Tweet from Brandon Savage so eloquently points out:

For newer frameworks, it’s harder to find developers, especially ones with experience.

More importantly, sometimes experience just flat out isn’t possible without a time machine. For a humorous take on it, there’s this Reddit post where a job description wanted a React developer with 5 years of experience back in 2017, at which point React had only been around for ~4 years.

You Don’t Have to Like PHP, But It’s Not Dead

You might not like PHP. Heck, even though we’re a managed WordPress host, we’d be lying if we said all of our developers love PHP. In fact, both our MyKinsta dashboard and affiliate dashboard are built entirely on Node and React, which are both JavaScript based, not PHP. But again, not liking PHP doesn’t mean it’s dead, or even dying.

Bjarne Stroustrup, the creator of C++, has a pertinent quote here:

There are only two kinds of languages: the ones people complain about and the ones nobody uses.

Yes, PHP does seem to be losing some steam according to W3Techs’ data. But even if PHP keeps decreasing at the same rate, it would take 25+ years before PHP even dropped under the 50% mark!

In the end, all of these posts about “Is PHP Dead?” are really just examples of Betteridge’s law of headlines – “Any headline that ends in a question mark can be answered by the word no.”

What do you think? Is PHP dead? Do you love PHP? Do you wish you could smother PHP with a pillow? Let us know in the comments!

The post Is PHP Dead? No! At Least Not According to PHP Usage Statistics appeared first on Kinsta Managed WordPress Hosting.

WordPress Cookies and PHP Sessions – Everything You Need to Know

Cookies were first invented in 1994 by a computer programmer named Lou Montulli. Without them, the web would be quite a different place. Whether your logging into the back-end of your WordPress site or closing an annoying popup window, you use and interact with cookies every day (even if you don’t realize it).

By now, you’ve probably guessed that when we refer to cookies, we mean the cookies used to store important visitor information on a website, not the yummy chocolate chip kind. 🍪

Today we’re going to dive into the sometimes confusing topic of cookies and PHP sessions. Specifically, everything you need to know about how WordPress uses them, along with some common issues that you should be aware of (especially as a developer) when it comes to hosting your website, custom code, or using a third-party plugin. In our opinion, this subject isn’t discussed enough.

  • Types of Cookies
  • How WordPress Core Uses Cookies
  • How Third-Party WordPress Plugins and Themes Use Cookies
  • Cookies and WordPress Caching
  • How to See and Clear Cookies
  • GDPR and Cookies
  • PHP Sessions

Types of Cookies

There are two different types of cookies that are commonly set: session cookies and persistent cookies.

Session Cookies

Session cookies, also known as transient cookies, are temporary. They don’t have an expiration date attached and only store information about what the user does during a single session. A session is simply a randomly generated/unique value that is assigned when someone visits a website. Session cookies are stored temporarily in memory and are automatically removed when the browser closes or the session ends.

Persistent Cookies

Persistent cookies, as you might have guessed, are those that contain an expiration date. These last much longer and are stored on disk until they expire or are manually cleared by the user. These are also sometimes referred to as “tracking cookies,” as these are the types of cookies that Google Analytics, AdRoll, Stripe, etc. all use.

Our Kinsta affiliate program is another example. A 60-day cookie is placed in the user’s browser when they click on an affiliate link. This ensures that the referrer gets proper credit, even if the person has closed and re-opened their browser multiple times.

How WordPress Core Uses Cookies

When we refer to WordPress core, we simply mean the files that make up the open source project, before installing any third-party plugins or themes. It’s WordPress in its natural state as we like to call it.

Now that you know the basics of what a cookie is and the different types, let’s take a look at why and how WordPress core uses them to make all that magic happen behind the scenes. Fun fact: Cookie was originally derived from the term “magic cookie.”

WordPress core uses cookies for two different purposes:

1. Login Cookies

Login cookies contain authentication details and are used when a user logs into the WordPress admin dashboard. According to the WordPress Codex, a couple of different session cookies are set:

  • On login, WordPress uses the wordpress_[hash] cookie to store authentication details (limited to the /wp-admin/ area).
  • After login, WordPress sets the wordpress_logged_in_[hash] cookie. This indicates when you’re logged in and who you are.

When you try to access the back-end of your WordPress site, a check is done to see if the two cookies above exist and haven’t expired. This is what allows you to magically bypass the wp-login.php screen. 😉

WordPress also sets wp-settings-{time}-[UID] cookies. The ID being your user ID from the WordPress users database table. This stores personal dashboard and admin interface settings.

2. Comment Cookies

By default, there are cookies set when someone comments on a blog post (with an expiration of 347 days). This is so if they come back later they don’t have to fill out all the information all over again. The following three cookies are stored:

  • comment_author_[hash]
  • comment_author_email_[hash]
  • comment_author_url_[hash]

However, with recent privacy policy changes due to GDPR, new tools have been introduced by WordPress core to make sure you let users opt-in to these cookies being set. This setting, if not already set, can be enabled under “Settings → Discussion” in your WordPress admin dashboard. Select the option to “Show comments cookies opt-in checkbox.” The popular Akismet plugin also allows you to display a privacy notice.

Show comments cookies opt-in

how comments cookies opt-in

How Third-Party WordPress Plugins and Themes Use Cookies

Just like WordPress uses cookies for certain functionality, third-party plugins and themes you install also set cookies. Most of them use a combination of browser cookies and database rows stored in the wp_options table or their own custom table. This is because WordPress is stateless.

A stateless app is an application program that does not save client data generated in one session for use in the next session with that client. Each session is carried out as if it was the first time and responses are not dependent upon data from a previous session. – TechTarget

With new privacy laws, it’s more important than ever to actually understand what cookies are being set and if they are providing a way for your visitors to opt-in. Tip: not all cookies require opt-in. Read our in-depth post on GDPR to get a better understand of new requirements.

Here are just a couple of the many examples of what cookies are used for:

  • If you have a popup box on your WordPress site and a visitor closes it, this typically will set a cookie so that it doesn’t come back again.
  • Items added to a shopping cart on your ecommerce site. A cookie is stored so that the shopping cart keeps your products while you continue to browse around the site.
  • GeoIP features might store the IP address and latitude/longitude coordinates of the visitor browsing the site. This is typically used to show specific content to a certain region or perhaps even redirect the user to a different subsite.
  • Tracking activity across clicks with a link shortener like the PrettyLinks plugin.
  • Newsletter plugin might set a cookie for users if they’ve already subscribed, this gives the ability to hide the newsletter box completely.

Essentially any action or opt-in on a WordPress site, typically will involve setting a cookie in the browser behind the scenes. The goal of this is, of course, to try and help improve the browser experience or provide additional functionality through verification.

WooCommerce Cookies

Ecommerce plugins such as WooCommerce typically have their own additional cookies they set so that buyers can easily add things to their cart, store for later when they checkout, and log in and out of their account.

To keep track of cart data, WooCommerce sets the following three cookies (no personal information is stored in the cookies):

  • woocommerce_cart_hash
  • woocommerce_items_in_cart
  • wp_woocommerce_session_

The first two cookies contain information about the cart and simply help WooCommerce know when the cart data changes. The third cookie wp_woocommerce_session_ contains a unique code for each customer which corresponds to an entry in the custom wp_woocommerce_sessions table in the database.

wp_woocommerce_sessions table

wp_woocommerce_sessions table

The wp_commerce_session_ data was previously stored in the wp_options table, but was moved to its own custom table in WooCommerce 2.5 when they introduced a new session handler. This was to improve performance, scalability, and management of sessions. Otherwise, you quickly end up with a bloated wp_options table you have to clean up.

Easy Digitial Downloads Cookies

Easy Digital Downloads by default uses WP_Session, which is a combination of browser cookies and database rows stored in the wp_options table. Below is the cookie it sets:

  • edd_items_in_cart

Cookies and WordPress Caching

When it comes to WordPress cache, this is where things get tricky. Caching is essentially the process of storing resources from one request and reusing those resources for subsequent requests. Basically, it reduces the amount of work required to generate a page view. While this is great for performance, it causes a problem when it comes to cookies.

Why? Because cookies are there to perform a certain action, such as keeping the shopping cart populated while you browse around a WooCommerce site. However, if a page is served from cache, neither PHP nor the database does anything, the server simply serves up a static copy of the page.

So what can you do?

1. Use JavaScript

The first option would be to use JavaScript and update content on a page dynamically. Basically, you have HTML placeholders and use JavaScript to pull in info over an API or ajax call.

An example would be loading a list of posts in the WordPress sidebar by using JavaScript to grab a list of posts over the wp-api and then render them in the sidebar. In that scenario you could update the list of posts without clearing the page from cache since the data is generated dynamically.

This isn’t ideal though, it’s always better to cache if possible in terms of performance. But if you must have some bit of content remain dynamic while the page itself can remain static (served from cache), that’s one way to do it – use JavaScript to pull down the content for that part of the page dynamically via an API/ajax call. However, unless you can hire a WordPress developer to build a custom JavaScript solution or extension of a plugin, this option usually isn’t practical.

2. Use Admin-Ajax Calls

Admin-ajax.php is not able to be cached, therefore you could use admin-ajax calls. A good example of this is the No Cache AJAX Widgets plugin. It makes admin-ajax calls and therefore doesn’t have to worry about conflicting with server-level or third-party caching solutions.

However, just like with JavaScript, going down this route is typically not feasible for the average user. It can also lead to other performance problems such as high admin-ajax usage and lots of uncached requests.

3. Exclude Pages From Cache (When the Cookie is Present)

Still looking for that perfect WordPress host?

Try Kinsta’s premium managed WordPress hosting to experience your site without problems.
  • Styleized controls representing management Fully managed
  • Shield with a tick representing securitySecure like Fort Knox
  • Merging lines representing migrationsFree migrations
  • Three right chevrons representing server speedUltimate speed
  • Circular arrow with center dot representing backupsDaily backups
  • Offset hexagons representing our server stackGoogle Cloud Platform
Check out our plans

Unless you can go down the JavaScript or admin-ajax route, excluding pages from caching when a specific cookie is present is the best way to go. This is typically what we recommend, especially those running highly dynamic sites such as WooCommerce and Easy Digital Downloads.

At Kinsta, certain WooCommerce and Easy Digital Downloads pages like cart, my-account, and checkout, are automatically excluded from caching. There is a server-level rule in place so that users automatically bypass the cache when the woocommerce_items_in_cart cookie or edd_items_in_cart cookie is detected to ensure a smooth and in-sync checkout process.

We also listen for the associated logged-in cookies and set the cache to bypass when we detect that someone has logged into WordPress. The prevents the back-end dashboard from accidentally being cached.

If you need a custom page excluded from cache, feel free to open up a ticket with our support team. Again, you have to be careful when it comes to exclusions. Too many uncached pages could really deteriorate performance. Check out our do’s and don’ts for hosting WordPress membership sites.

How to See and Clear Cookies

It’s easy to see and clear cookies on a website. To see what cookies are set on a specific site, browse to that site and click on the little padlock icon at the top. Then click on “Cookies.”

Struggling with downtime and WordPress problems? Kinsta is the hosting solution designed to save you time! Check out our features
Cookies in use

Cookies in use

Then drill down to that website’s folder. In the example below, you can see that we have a few WooCommerce cookies set, as well as the wordpress_logged_in_[hash] cookie. You can also see the expires time and whether it is a persistent cookie or session cookie (when the browsing session ends).

WordPress cookies

WordPress cookies

To remove a cookie, simply click on an individual cookie and click the “Remove” button. You can also do this at the folder level or in Chrome DevTools.

Alternatively, you can search for or clear all cookies in your browser.

GDPR and Cookies

GDPR is a new privacy law that came into effect on May 25th, 2018. It was designed to give citizens back control of their personal data. We highly recommend reading our in-depth post: the lowdown on GDPR compliance if you haven’t already. This is one topic that can’t be summarized in a paragraph!

Here is an example of one change we made at Kinsta to help comply with the new law. When you first visit our site, you might have already seen it, you’re met with an “Accept Cookies” prompt at the bottom of the screen. This is because we are now legally required to provide users a way to opt-in and opt-out of cookies being set. Gone are the days of just running whatever you want without informing users of data collection.

Accept cookies

Accept cookies

If you click “Accept Cookies,” all cookies are then set for the user. If you click “Cookie Settings,” we now provide a way to opt-in and opt-out of whichever cookies you want.

Cookie settings

Cookie settings

Pretty nifty right? Our cookie solution was built in-house by our developers, but here are some helpful GDPR WordPress plugins that can help you accomplish something similar. Again, cookies are just one small part of becoming completely GDPR compliant.

PHP Sessions

PHP sessions is an alternative to the standard cookie approach. It’s still a cookie, but it’s called PHPSESSID and is typically stored in the /tmp/ directory on the web server itself. The way the server knows to associate a given session with a given request is that it’s also stored in an HTTP cookie.

PHPSESSID HTTP cookie

PHPSESSID HTTP cookie

This can also be seen under the HTTP header for a site.

HTTP header set cookie PHPSESSID

HTTP header set cookie PHPSESSID

A PHP session is much like a normal session which ends when the user closes their browser.

The problem with PHP sessions all comes down to performance and caching issues. The information stored in the browser cookie has to bounce back and forth with each request so that the server knows who the user is. This means for sites that use PHPSESSID, the host would have to set the PHPSESSID to bypass the cache. However, the result is that PHPSESSID would have to be set to bypass 100% of the time, because unlike  wordpress_logged_in, the PHPSESSID is set on every single PHP request.

So imagine that the wordpress_logged_in had to be set 100% of the time to allow login functionality to work. Meaning that even logged-out users would have to have the cookie and it would have to be unique to them. Imagine that was required in order for the WordPress login system to work. In that scenario, every single page view would have to bypass cache so that the wordpress_logged_in cookie was set correctly both for logged in and logged out users.

That’s the problem with using PHPSESSID. Because it’s generated on every single PHP request, if a site relies on PHPSESSID cookies the host would have to set PHPSESSID to bypass cache 100% of the time. Otherwise, the PHPSESSID’s end up cached and it messes up whatever functionality relies on it.

We don’t recommend using PHP sessions and they will usually not work in our Kinsta environment. PHP sessions also have other security implications that should be considered.

If you see code using session_start on your site, this means its using PHP sessions.

Many plugin and theme developers have moved to using a combination of browser cookies and database rows (either in the wp_options table or their own custom table). If you need session data this is the better approach.

Feel free to reach out to our support team if you have additional questions regarding PHP sessions.

Summary

Hopefully, now you know a little bit more about how WordPress cookies and PHP sessions work than you did before. Cookies are currently what makes the world go round and are important for pretty much everything that happens on a WordPress site. From keeping us logged in, to ensuring a smooth shopping cart experience, and even making sure that a popup window stays closed.

Have any other questions about cookies? 🍪 Let us know below in the comments.

The post WordPress Cookies and PHP Sessions – Everything You Need to Know appeared first on Kinsta Managed WordPress Hosting.

What’s New in PHP 7.3 (Now Available at Kinsta)

As of December 6th, 2018, the latest and greatest version, PHP 7.3 is here! With it comes new useful features, functionalities, deprecations, a good number of bug fixes, and a boost in performance. PHP 7.3 is also now available to all Kinsta clients in the MyKinsta dashboard. 🤘

In this post, we’ll provide an overview of the features and changes that we personally consider most relevant. But you can always check the full list of features, changes and bug fixes in PHP 7.3 upgrade notes and PHP 7.3 Requests For Comments.

What’s New in PHP with PHP 7.3?

In this post we’re covering the following PHP 7.3 changes:

  • Implemented Flexible Heredoc And Nowdoc Syntaxes
  • Allow a Trailing Comma in Function Calls
  • JSON_THROW_ON_ERROR
  • list() Reference Assignment
  • is_countable Function
  • array_key_first(), array_key_last()
  • Argon2 Password Hash Enhancements
  • Deprecations

Flexible Heredoc and Nowdoc Syntaxes

This is probably one of the most relevant improvements coming with PHP 7.3, and we think it deserves a little more attention. So, before diving into PHP 7.3 heredoc/nowdoc changes, we’ll provide a quick overview of this useful core feature. If you are already confident with nowdoc and heredoc, feel free to jump to the PHP 7.3 changes.

  • An overview of heredoc and nowdoc syntaxes
  • PHP 7.3: Allow for the closing marker to be indented and for the leading whitespace to be stripped
  • PHP 7.3: Remove the Trailing New Line Requirement From the Closing Marker

An overview of heredoc and nowdoc syntaxes

The heredoc syntax provides a way of adding a large amount of text without the need to escape things like double quotes. A heredoc starts with <<< followed by a marker, and ends with the same marker followed by a semicolon. Here is an example:

print <<<EOT Heredoc text behaves just like a double-quoted string, without the double quotes. EOT;

A nowdoc behaves much like a heredoc, with some exceptions:

  • The identifier is enclosed in single quotes (<<<'EOT')
  • No parsing is done inside a nowdoc

Here is an example of nowdoc:

print <<<'EOT' Nowdocs are to single-quoted strings what heredocs are to double-quoted strings. EOT;

Heredocs and nowdocs share the same rules regulating the usage of the closing marker:

  1. The closing marker must begin in the first column of the line
  2. The marker must follow the same naming rules as any other label in PHP: it must contain only alphanumeric characters and underscores, and must start with a non-digit character or underscore.

The PHP Manual warns:

It is very important to note that the line with the closing identifier must contain no other characters, except a semicolon (;). That means especially that the identifier may not be indented, and there may not be any spaces or tabs before or after the semicolon. It’s also important to realize that the first character before the closing identifier must be a newline as defined by the local operating system. This is \n on UNIX systems, including macOS. The closing delimiter must also be followed by a newline.

PHP 7.2 invalid syntax:

class foo { public $bar = <<<EOT bar EOT; } // Identifier must not be indented

PHP 7.2 valid syntax:

class foo { public $bar = <<<EOT bar EOT; }

To keep it short, in PHP 7.2:

  • The closing marker may not be indented
  • The line with the closing marker may not contain characters like spaces or tabs
  • The first character before the closing marker must be a newline
  • The closing marker must be followed by a newline

It’s clear enough that heredoc and nowdoc syntaxes are quite restrictive, but PHP 7.3 may change this a little with the following improvements.

1. Allow for the closing marker to be indented and for the leading whitespace to be stripped

With PHP 7.3 we are allowed to indent the closing marker, and we can safely write the following code:

class foo { public $bar = <<<EOT bar EOT; }

The indentation of the closing marker sets the amount of whitespace (or tabs) that will be stripped from each line of the body. But be careful: the closing marker should never be indented further than any other line of the body.

See the code below:

class foo { public $bar = <<<EOT bar EOT; }

The code above would issue the following parse error:

Parse error: Invalid body indentation level (expecting an indentation at least ...) in %s on line %d

Stripping tabs and whitespaces allow us to indent the body of the heredoc/nowdoc to the same level of the code around, and without unnecessary whitespace before each line of the body.

We can use both tabs and spaces for indentation, but we are not allowed to use them intermixed. This means that we must use the same indentation characters for the closing marker and any lines of the body. In case of different indentation characters, we’d expect a different type of parse error (invalid indentation).

2. Remove the Trailing New Line Requirement From the Closing Marker

Currently, a new line must follow the marker in order to terminate the heredoc/nowdoc. PHP 7.3 would change this and would allow us to terminate the heredoc/nowdoc on the same line. Here is an example from the RFC:

PHP 7.2 valid syntax:

$values = [<<<END a b c END , 'd e f'];

PHP 7.3 valid syntax:

$values = [<<<END a b c END, 'd e f'];

Anyway, be careful when choosing the name of your marker because “occasionally” you may expect an error if it matches a word you used in the body of the heredoc/nowdoc (read more on this on the RFC and GitHub).

Both proposals passed with more than 2/3 votes.

PHP 7.3 RFC

  • Flexible Heredoc and Nowdoc Syntaxes

Additional Resources

  • Heredoc string syntax
  • Nowdoc string syntax

Allow a trailing comma in function calls

Trailing commas (or “final commas”) are commas appended to a list of elements, parameters or properties and they come in handy in contexts where new values are appended frequently because they prevent errors due to a missing comma. In PHP trailing commas are allowed in arrays, and as of PHP 7.2 they are allowed in grouped namespaces.

As of PHP 7.3, trailing commas would be allowed in function declarations. Variadic functions provide an example of context where trailing commas are extremely useful:

foo( $bar, $baz, );

We can use a trailing comma when we are creating an array with compact(), in order to return a formatted string with sprintf(), or when merging an array:

$newArray = array_merge( $arrayOne, $arrayTwo, ['foo', 'bar'], );

Also, trailing commas would be useful for debugging:

var_dump( $foo, $bar, $baz, );

And they are powerful with unset() and isset():

unset( $foo, $bar, $baz, ); isset( $foo, $bar, $baz, );

Trailing commas will be allowed in method calls and enclosures, as well.

Note: This change would affect function calls only. Function declaration syntax will not change. Moreover, free-standing commas, multiple trailing commas, and leading commas will not be allowed.

Additional examples can be found on the RFC page. This RFC passed with a 30 to 10 vote.

PHP 7.3 RFC

  • Flexible Heredoc and Nowdoc Syntaxes

JSON_THROW_ON_ERROR

One of the most appreciated functionalities coming with PHP 7.3 provides a new way of handling JSON errors. This is not a core feature, but an addition to the JSON extension that would change the error behaviour of json_decode() and json_encode().

Currently, json_decode() returns null on error, but null can also be a valid result. This could be confusing, because

It is only possible to know if an error occurred by calling json_last_error() or json_last_error_msg(), which return the global error state in machine-readable and human-readable forms respectively. – PHP RFC

json_encode() returns FALSE on error. This is clearer because there is a specific error value. Anyway, both functions neither halt program execution on error, nor throw any warning.

With that being said, here is the proposal for PHP 7.3:

This RFC instead proposes adding a new option flag value for json_decode() and json_encode(), JSON_THROW_ON_ERROR. When passed this flag, the error behaviour of these functions is changed. The global error state is left untouched, and if an error occurs that would otherwise set it, these functions instead throw a JsonException with the message and code set to whatever json_last_error() and json_last_error_msg() would otherwise be respectively.

Here is an example showing a simple way of throwing a JSON error:

try { json_decode("{", false, 512, JSON_THROW_ON_ERROR); } catch (\JsonException $exception) { echo $exception->getMessage(); // echoes "Syntax error" }

Throwing an exception upon error would give several advantages that you’ll find listed on the RFC.

Note: an invalid depth parameter passed to json_decode() outputs a warning and returns NULL. This behaviour will not be affected by JSON_THROW_ON_ERROR. Similarly, parameter parsing errors are not affected by JSON_THROW_ON_ERROR and continue to produce warnings.

This proposal passed with 23 to 0 votes.

PHP 7.3 RFC

  • JSON_THROW_ON_ERROR

Additional Resources

  • JavaScript Object Notation
  • json_decode()
  • json_encode()
  • json_last_error()
  • json_last_error_msg()
  • PHP Language Exceptions

list() Reference Assignment

What Does Reference Assignment Mean?

Consider the following line:

$b = &$a;

Here $b gets the value of $a, but that value is not copied from $a to $b. In PHP we can assign a value by reference, meaning that two variables may point to the same data, and every change to any variable affects the original data. Here is an example from the PHP manual:

<?php $a = 3; $b = &$a; // $b is a reference to $a print "$a\n"; // prints 3 print "$b\n"; // prints 3

Now, let’s change the value of $a:

$a = 4; // change $a print "$a\n"; // prints 4 print "$b\n"; // prints 4 as well, since $b is a reference to $a, which has been changed

What Is The list() Construct and How It Changes With PHP 7.3

The list() language construct can be used to “assign variables as if they were in an array”, but with list() we are not currently allowed to assign variable values by reference.

PHP 7.3 should change this allowing us to assign variables by reference also with the list() construct, as shown in the following example:

$array = [1, 2]; list($a, &$b) = $array;

Which is the same as:

$array = [1, 2]; $a = $array[0]; $b =& $array[1];

The advantage of this proposal is that we could now assign multiple variables by reference, which was not currently allowed. More examples are available on the RFC. This proposal passed with 17 to 7 votes.

PHP 7.3 RFC

  • list() Reference Assignment

Additional Resources

  • PHP Manual – list()
  • PHP Manual – References Explained
  • Assignment Operators – Assignment by Reference

is_countable Function

Another useful feature coming with PHP 7.3 is the is_countable() function. Up to PHP 7.2, we get an error when attempting to count() something that is not countable. For this reason, in order to avoid a warning, we are forced to add the following code:

if (is_array($foo) || $foo instanceof Countable) { // $foo is countable }

This RFC proposes the function is_countable(), which returns true if the given variable is an array or it is a countable variable, false otherwise. So, the code above could be changed as follows:

if (is_countable($foo)) { // $foo is countable }

This proposal passed with 25 to 0 votes.

PHP 7.3 RFC

  • is_countable

Additional Resources

  • The Countable interface
  • count

array_key_first(), array_key_last()

Currently, we can retrieve the first and the last key of an array by using reset(), end() and key() functions. Unfortunately, with these functions, there’s no way to gather the first or the last index of an array without changing its internal state. Other options usually reduce code readability and performance.
This proposal would change this scenario by adding two new functions to PHP core:

  • array_key_first()
  • array_key_last()

As of PHP 7.3, array_key_first() and array_key_last() allow to retrieve the first and the last key of a given array without affecting the internal array pointer. These new functions would allow us to write less complex code and in some cases avoid errors. See the RFC for further information and several examples.

array_key_first() and array_key_last() have been approved with 18 to 14 votes.

Note: the original RFC proposed two more functions, array_value_first() and array_value_last(), which were voted in a different poll, but haven’t been approved and won’t become parte of PHP core.

PHP 7.3 RFC

  • array_key_first(), array_key_last()

Additional Resources

  • array_key_first
  • array_key_last

Argon2 Password Hash Enhancements

Argon2 is a hashing algorithm implemented in PHP 7.2 as an alternative to the Bcrypt algorithm. PHP 7.2 introduced the PASSWORD_ARGON2I constant, available to be used in password_* functions:

password_hash('password', PASSWORD_ARGON2I);

Since its first implementation, a new variant of Argon2 has been added, so, at the time of this writing, Argon2 comes in three variants:

  • Argon2d maximizes resistance to GPU cracking attacks. It is faster and uses data-depending memory access.
  • Argon2i uses data-independent memory access, which is preferred for password hashing. It is slower as it makes more passes over the memory to protect from tradeoff attacks.
  • Argon2id is a hybrid version that combines the Argon2i approach for the first pass over memory, and the Argon2d approach for subsequent passes.

Argon2id is recommended on the Internet, except when there are good reasons to specifically prefer another variant.

The new RFC proposes the implementation of Argon2id within the password_* functions with the new PASSWORD_ARGON2ID constant:

password_hash('password', PASSWORD_ARGON2ID);

The implementation is identical to the Argon2i implementation, and will accept the same cost factors:

Struggling with downtime and WordPress problems? Kinsta is the hosting solution designed to save you time! Check out our features
  • A memory cost which defines the number of KiB that should be consumed during hashing (default values are 1<<10, or 1024 KiB, or 1 MiB)
  • A time cost that defines the number of iterations of the hashing algorithm (defaults to 2)
  • A parallelism factor, which sets the number of parallel threads that will be used during hashing (defaults to 2)

See the following code:

$options = ['memory_cost' => 1<<11, 'time_cost' => 4, 'threads' => 2]; password_hash('password', PASSWORD_ARGON2ID, $options);

More information and examples on the RFC.

PHP 7.3 RFC

  • Argon2 Password Hash Enhancements

Additional Resources

  • Argon2 (Wikipedia)
  • Argon2: the memory-hard function for password hashing and other applications (PDF)

Deprecations

The following functions/functionalities will be deprecated with PHP 7.3 and removed not later than PHP 8.0.

Deprecate and Remove image2wbmp()

The image2wbmp() function outputs or save a WBMP version of a given image. This function takes three arguments: an image resource, a filename (the path to the saved file), and a foreground color.
As of PHP 5.0, it is identical to imagewbmp(), so this RFC proposes to deprecate and remove it.
Since PHP 7.3, each call to image2wbmp() would issue a deprecation warning. After the removal, each call would throw a fatal error.

PHP 7.3 RFC

  • Deprecate and Remove image2wbmp()

Deprecate and Remove Case-Insensitive Constants

PHP currently supports both case-sensitive and case-insensitive constants. Anyway, case-insensitive constants are supported but considered subject to inconsistencies in functionalities and to be complex to use.
This proposal begins with the following premises:

  • class constants are always case-sensitive
  • global constants declared with const are always case-sensitive
  • constants defined with define() are case-sensitive by default

In addition, the PHP Language Reference explicitely states:

A constant is case-sensitive by default. By convention, constant identifiers are always uppercase.

That being said, this RFC proposes the following changes:

  • Deprecate calling define() with third parameter set to true – PHP 7.3
  • Deprecate accessing case-insensitive constants with a casing different from the declaration (with the exception of true, false and null) – PHP 7.3
  • Remove the possibility to declare case-insensitive constants – PHP 8.0
  • Convert true, false and null from special-cased constants into reserved keywords – PHP 8.0

PHP 7.3 RFC

Deprecate and Remove Case-Insensitive Constants.

Additional Deprecations for PHP 7.3

Here is a quick list of functionalities being deprecated in PHP 7.3. It’s not exhaustive, they’re just the deprecation proposals I personally consider more relevant. For a full list of proposed deprecations, see Deprecations for PHP 7.3.

Undocumented mbstring function aliases: there’s a number of undocumented mbstring function aliases that are duplications of equivalent functions using mb_ prefix. For example, mbereg is an alias of mb_ereg.
All these functions would be marked as deprecated and a deprecation notice would be thrown when they are encountered during compilation.

String search functions with integer needle: these functions usually operate on string needles. If a non-string needle is given, it is converted to an integer and applied as the ordinal value of a character (read more on the PHP manual). Here is an example from the RFC:

$str = "There are 10 apples"; var_dump(strpos($str, "10")); // int(10) var_dump(strpos($str, 10)); // bool(false)

This is considered to be confusing and cause unpredictable issues because the type can change with the user data source. For this reason, the RFC proposes the issue of a deprecation warning if a non-string needle is passed to one of the following functions:

  • strpos
  • strrpos
  • stripos
  • strripos
  • strstr
  • strchr
  • strrchr
  • stristr

In PHP 8.0, the deprecation warning should be removed and the needles should be automatically converted into strings.

Still looking for that perfect WordPress host?

Try Kinsta’s premium managed WordPress hosting to experience your site without problems.
  • Styleized controls representing management Fully managed
  • Shield with a tick representing securitySecure like Fort Knox
  • Merging lines representing migrationsFree migrations
  • Three right chevrons representing server speedUltimate speed
  • Circular arrow with center dot representing backupsDaily backups
  • Offset hexagons representing our server stackGoogle Cloud Platform
Check out our plans

fgetss() function and string.strip_tags stream filter: fgetss() and string.strip_tags strip tags from a stream as they read it. Both the function and the filter expose the strip_tags() functionality making the implementation of strip_tags() more complex, as a streaming state machine is required. Additionally, the RFC points out another disadvantage of these functions:

On the other hand, these functions seem to be of very little utility. strip_tags() itself, due to its limitations and known bugs, already has very few legitimate applications. There is no need to provide native support for streaming application on top of that.

So the RFC proposes to mark fgetss(), gzgetss() and SplFileObject::fgetss() as deprecated.

What Does PHP 7.3 Mean for WordPress Users?

According to the official WordPress Stats page, as of writing this, only 32.9% of WordPress users have upgraded to PHP 7 or higher. Just 4% are using PHP 7.2. You can see that a large majority of users, over 38%, are still running on PHP 5.6. What’s even scarier is that over 28.5% of users are using unsupported PHP versions. As of December 2016, WordPress.org actually bumped up their official recommendation for users from PHP 5.6 to PHP 7 or greater.

WordPress PHP versions

WordPress PHP versions

PHP 7 Performance

The numbers above are especially discouraging coming from a performance point of view, as PHP 7 has shown to be significantly faster. Here are a few stats:

  • Official PHP benchmarks show that PHP 7 allows the system to execute twice as many requests per second in comparison with the PHP 5.6, at almost half of the latency.
  • Christian Vigh also published a PHP performance comparison in which he found that PHP 5.2 was 400% slower than PHP 7.

We ran our own PHP performance benchmarks. And similarly to the benchmarks above, we saw that WordPress 5.0 on PHP 7.3 could execute almost three times as many transactions (requests) per second as compared to PHP 5.6.

WordPress 5.0 PHP benchmarks

WordPress 5.0 PHP benchmarks

  • WordPress 5.0 PHP 5.6 benchmark: 91.64 req/sec
  • WordPress 5.0 PHP 7.0 benchmark results: 206.71 req/sec
  • WordPress 5.0 PHP 7.1 benchmark results: 210.98 req/sec
  • WordPress 5.0 PHP 7.2 benchmark results: 229.18 req/sec 
  • WordPress 5.0 PHP 7.3 benchmark results: 253.20 req/sec 🏆

It’s also interesting to note that WordPress 4.9.8 on PHP 7.3 was slightly faster than WordPress 5.0.

WordPress 4.9.8 PHP benchmarks

WordPress 4.9.8 PHP benchmarks

  • WordPress 4.9.8 PHP 5.6 benchmark: 97.59 req/sec
  • WordPress 4.9.8 PHP 7.0 benchmark results: 221.42 req/sec
  • WordPress 4.9.8 PHP 7.1 benchmark results: 233.78 req/sec
  • WordPress 4.9.8 PHP 7.2 benchmark results: 250.36 req/sec 
  • WordPress 4.9.8 PHP 7.3 benchmark results: 276.31 req/sec 🏆

Many are slow to update simply because of the time involved with testing new all their third-party plugins and themes to ensure they function properly. But a lot of times, it comes down to they simply haven’t done it yet.

Checking Your PHP Version

Not sure what version of PHP you’re running? One of the easiest ways to check is to use a tool like Pingdom or Google Chrome Devtools. The first HTTP request header will typically show you the version.

Check version of PHP

Check version of PHP

This relies on the host not modifying the X-Powered-By header value. If they do, you might not see your PHP version. In which case, you could also install a free plugin like Version Info which will show you some basic server information in the footer of your WordPress admin dashboard.

Check PHP version in WordPress

Check PHP version in WordPress

Alternatively, you could also upload a file via FTP to see your PHP version, or reach out to your host and ask.

Updating to PHP 7.3

The final version of PHP 7.3 is here and you can start testing it right away. You could test your WordPress site locally or check your scripts in an environment like Docker, which allows you to test different versions of PHP from the command line.

Or you can utilize a staging environment, as this will more closely resemble a live production site. Create a staging environment with a few simple clicks in the MyKinsta dashboard.

WordPress staging environment

WordPress staging environment

We always recommend testing thoroughly before using it on a production site. To do so, simply change the PHP Engine for the staging site under “Tools” and you can start testing to ensure compatibility of your third-party plugins and themes.

Change to PHP 7.3

Change to PHP 7.3

Once you confirm everything works, you can either change your production site over to PHP 7.3 or if you’ve made any changes, also push your staging site to live.

Summary

The latest and greatest version of PHP is here. It bring us gifts like flexible heredocs and nowdocs, trailing commas in function calls, list() reference assignments and more. In this post, we’ve provided an overview of our favorite improvements and changes, but we would also like to know which are your favorite ones, and in which ways you’ll take advantage of them. Let us know in the comments below. And don’t forget PHP is not dead!

You can find the full list of PHP 7.3 proposals on the Requests For Comments page and GitHub’s PHP 7.3 Upgrade Notes.

The post What’s New in PHP 7.3 (Now Available at Kinsta) appeared first on Kinsta Managed WordPress Hosting.