Assuming you’re familiar with PHP, on this page you’ll learn even more about it. PHP has released PHP 7, which was, in fact, a big deal, considering they aren’t too frequent with releases. The popular server-side scripting language is widely used worldwide.
I will do my best to educate you on the ins and outs of PHP 7, along with the best ways to select the right hosting provider for your project. Enjoy the read!
What is PHP 7?
PHP 7 is a major version of PHP whose first stable edition was released on December 3, 2015. The release of PHP 7 marks the first time a new version of PHP has been released in over a decade since PHP5 was released in 2004.
Server Side Scripting
PHP 7 is a server-side scripting language. This means that a web server is required to run the language. As a result, when an internet user lands on a website, a script is run on the web server where the website is hosted, and dynamic HTML pages are generated. The pages are then sent to the user’s browser.
Server-side scripting allows for customized access to web pages, such as requiring log-ins to access content. For example, you could have data stores on the server to create log-in accounts for website users. Knowing this, it’s easy to see why PHP 7 powers so much of the internet.
Originally dubbed PHP next generation (phpng), PHP 7 is a major version of PHP that provides dramatic performance improvements over previous versions of PHP.
Tests performed during development of PHP 7 indicate that applications running on the new version outperform the same applications running on previous versions of PHP by approximately 100%.
The Latest Version of PHP
Originally released on December 3, 2015, PHP 7 will be supported through at least 2018. However, if history is any indication, PHP 7 may be the dominant version of PHP for a decade or longer.
PHP Goes Commercial
In 1997, the company Zend got involved in PHP by rewriting the core scripting engine of the language. This aided PHP in becoming a full-featured development language. When PHP 4 was released, Zend introduced Zend Engine.
This allowed for modules to be added to extend the functionality of PHP. Zend Engine has made it possible to use plug-in modules like performance boosters and debuggers with PHP, making developers lives a whole lot easier.
The latest version, Zend Engine 3.0 was released with PHP 7. This version, called Next Generation, resulted in 2x faster performance as well as 50% better memory consumption than previous versions of PHP.
Wait! What Happened to PHP 6?
PHP homepage screenshot
Development of PHP 6 was announced in 2005. The primary motivation behind the development of PHP 6 was to add native support for Unicode to the language core. There weren’t enough developers committed to the project who understood what needed to happen to make the project a success.
As a result, some of the features that were supposed to be part of PHP 6 were siphoned into a minor update of PHP 5 with the release of PHP 5.3 in 2009.
No PHP 6
The PHP 6 project was formally abandoned in 2010. To avoid confusion, when the development of PHP 7 was well underway, the decision was made to skip over PHP 6 entirely in the naming sequence of stable versions of PHP.
Sorry, No Unicode!
It’s worth noting that full Unicode support still hasn’t made it into PHP. The goals of the PHP 6 development team remain largely unachieved. But hey, it’s a new era – let’s get to the important part, PHP 7.
What’s New with PHP 7?
According to The PHP Group, PHP 7 provides many improvements and new features while still supporting near complete backward compatibility with previous versions of PHP. A few of the most noteworthy improvements include:
Improvement in Speed
Reduced server memory usage
Improved Error Handling
Encrypted number generation
Improvement in Speed
One of PHP 7’s selling points is its increased speed compared to the previous version. If you’re building a web app, time is money. The longer users stay on your site, the more money you’ll get. Faster response times will make users want to stick around.
Reduced Memory Usage
A reduced memory footprint will also make your site faster, potentially making users stay on it longer. As mentioned earlier, PHP 7 used somewhat 50% less memory than it’s predecessor.
Improved Error Handling
PHP 7 release notes
The improved error handling in PHP 7 has removed fatal errors that were a problem in previous versions. When an error occurred previously, the script would stop.
This resulted in a blank screen to users, something that’s not very good for developing a web presence. Instead, PHP 7 handles errors with throwable exceptions. This prevents scripts from stopping and makes it easier for developers to fix problems.
Along with improved error handling, PHP 7 introduces type declarations to help developers write better code. Developers can declare a type for a variable, such as a string or an integer. If they try to do things that can only be done with a certain type, PHP will give an error message.
Unlike other languages like C, type declaration is optional.
Encrypted Number Generation
PHP 7 encrypts its data with a specific method and key. Following the encryption, it returns a base 64 or raw encoded string. The encrypted string can be returned as either false or successful.
PHP 5 vs PHP 7
Furthermore, let’s take a look at some
Almost 2x faster
Higher (with fewer servers)
How do I get PHP 7?
PHP 7 upgrade screenshot
If you want to get started using PHP 7 either on your own web server or your local development environment, you can download an installation package for your operating system. The major server OSes are all supported, some of them by the PHP project itself or third parties:
If you don’t run your own web server, you’ll have to wait on your hosting provider to make PHP 7 available on their web servers or switch to one of the PHP 7 hosts listed above.
How to Pick a PHP 7 Hosting Company
There is a great WordPress plugin for checking compatibility.
By today, most hosting companies have made the switch and now offer support for PHP 7. But there may still be some companies that don’t, so make sure you check before choosing a provider. You can usually find a host’s supported PHP versions in their feature lists.
Many host providers allow you to pick your version of PHP and switch when there is a new version released. There are several steps:
Find a host with PHP 7 installed
Make sure your framework or app is compatible with PHP 7
Alternatively, install PHP 7 on your own server
Look for a host with FTP access if you’re using WordPress
Consider a host that supports WordPress, as it’ll likely support PHP well
Find a Host of PHP 7 Installed
This step shouldn’t be too difficult. Most hosts figure you won’t care what version of PHP installed, but a good host will have a recent version.
Check Framework and App Compatibility
If you depend on PHP frameworks or apps, you’ll have to make sure they’re compatible with PHP 7 before you upgrade. Check the documentation or user forums for any incompatibilities, bugs, or workarounds.
Install PHP 7 on Your Own Server
If you have an unmanaged VPS, cloud, or dedicated server, you can install PHP 7 yourself. You should follow the instructions for whatever operating system you’re using on your server to install it.
If you’re interested in having developer access, you’ll want to check out the included features of each web hosting company. Many providers will give you access to the source PHP code for your website. If you’re building your website on WordPress, you can access PHP theme files to make changes.
You aren’t advised to mess around with this stuff unless you know what you’re doing. Incorrectly editing source code can cause your website to crash.
When looking for a web hosting company, find one that gives you FTP access. To take advantage of this, you’ll need to create FTP login credentials from the cPanel control panel in your hosting account.
You’ll be able to use this information with a free FTP client, such as FileZilla, to access the source code for your WordPress website.
PHP and WordPress
WordPress is primarily written in PHP. Meaning, PHP support is essential for hosting WordPress websites. There are many reasons why you should be running your WordPress website on PHP 7.
Increased Speed with PHP 7
The one that will concern most website owners is the increased speed that comes with this latest version of PHP. PHP 7 is able to serve requests twice as fast as PHP 5.6. This means you can get higher speeds for your WordPress website by switching to PHP 7.
To do this, you will need to choose a web hosting company that supports the programming language.
WordPress Hosts Are Good PHP 7 Hosts
Ideally, you would choose to host your website from one of the best host providers for WordPress as these companies will likely support PHP 7. Optimized WordPress plans will give you the highest possible speeds for your websites.
For example, InMotion hosting has WordPress optimized hosting plans which fully support PHP 7. On that note, InMotion is one of our trusted hosting providers, with decent credentials and feedback under their name.
How to Make the Switch
Switching to PHP 7 in your hosting account is pretty straightforward. Simply navigate to your hosting account control panel, look for the PHP version manager, and select the version of PHP you want to use to run your web applications.
PHP 7 Backward Compatibility
Are you a developer with an application live on the web and you want to switch to PHP 7 from an older version? It’s important to test the backward compatibility of the code that powers your application before upgrading to PHP 7 on your server.
Before you make the jump use PHP7MAR to identify compatibility issues. Furthermore, use php7cc to have a second set of (virtual) eyes look over your code, and php7ize to automatically add PHP 7 features to PHP 5 code.
Test for Errors and Functionality
The last step before you switch to PHP 7 on the web server is to set up PHP 7 in a local environment and test your codebase for errors and functionality locally. Once you have an error-free operation and up-to-date backups on hand you’re ready to make the transition.
Migrating PHP Code to PHP 7
The PHP Foundation has also provided an extensive Migration Manual to help developers plan and handle the transition from previous versions.
The manual covers topics such as backward compatibility, new features, deprecated features, new and changed functions, and much more.
The Top Three PHP 7 Hosts
There are three hosting providers we think you should look at if you want to build a PHP 7 site:
Our first choice for PHP 7 hosting is SiteGround. The web hosting company has dedicated PHP hosting plans that are crafted to run PHP 7 with superior performance. You can choose between multiple PHP versions, switching between them easily.
They even give you support for PHP 7.1. The result of their PHP optimized hosting is faster and more secure PHP executions. And, you’ll have access to multiple PHP modules. SiteGround also boasts their developer features like pre-installed Git and staging environments.
A2 Hosting is another PHP-focused web host. Slightly more expensive than SiteGround, A2 gives you an anytime money-back guarantee. This means you can try them out completely risk-free.
We like that A2’s PHP 7 hosting includes unlimited resources unlike SiteGround’s which limits your disk space. Developers may be interested to know that A2 allows you to have root access to their VPS plans. This allows for full customization of your hosting environment.
WebHostFace comes out on top as the cheapest possible hosting option. Despite this, their budget-friendly shared hosting plan included free SSL certificates. Their affordable VPS plan includes a dedicated IP address.
Though they also restrict your disk space, WebHostFace gives you unlimited bandwidth, a free CDN, daily backups, and powerful SSD-powered servers. They let you manage website files via cPanel or FTP.
One of the best things about this company is their support team who is knowledgeable about all things PHP.
Frequently Asked Questions
As with anything, there are things noone understands, even after a detailed read of the most informative page on the topic. For this reason, check out some further, in-depth explanation of some of the most common questions on PHP 7.
Are previous versions of PHP now obsolete?
Each release of a version of PHP – both major releases such as PHP 7, and minor releases such as PHP 7.1 – is supported with bug and security fixes for at least three years.
After that time, versions of PHP often remain in regular use until major bugs and security loopholes force them into disuse. Previous versions of PHP will remain in regular use until the hosting industry deems them too insecure for modern web servers.
Are previous versions of PHP compatible with PHP 7?
There are a few compatibility issues between PHP 7 and previous versions of PHP. The majority of applications developed with relatively recent versions of PHP should work well with PHP 7.
To confirm compatibility before making the change review the resources we listed above.