PHP 8 Is now available – Chance to win 6 Months of free hosting

PHP 8

We’re happy to announce that we have deployed the latest release candidate version of PHP 8 on all our servers. PHP 8 is expected to facilitate developers to write cleaner code with better quality that gets executed faster. Since release candidates are not suitable for live sites, we invite you to try it out on a staging copy of your site or on projects that are not live yet. We’ll give away 6 Months of our Deluxe shared hosting to 10 of the early adopters who share their opinion about PHP 8 with us. 

What are the PHP 8 improvements and features

Faster code execution

The latest PHP version brings a lot of new things but the one we are obsessed with is JIT (just in time compiler). It is the first time that PHP version has a compiler – JIT – that caches a version of your already interpreted code and generates a machine code as an output (machine code is on with 0’s and 1’s only). The “just in time” compiler promises speed improvements for complex tasks and algorithms and opens new opportunities for the PHP language to broaden its reach and applications. 

Some of you may wonder how JIT relates to the Opcache, which brought significant performance gains to many websites? The main job of the Opcache is to cut the processes of tokenization, parsing, and compiling of Opcodes, which then get processed by the Zend engine. The role of JIT is to save on the execution of the Opcodes by the Zend engine, so it joins forces and intervenes to spare resources where the Opcache cannot help.

It’s worth mentioning a few downsides we have noticed so far:

  • Running PHP 8 with JIT might make it harder for you to troubleshoot code errors because it may be harder to locate which piece of your code in this interpreted version is actually at fault.
  • If you are running a WordPress site you may not be able to note significant performance improvements thanks to JIT. The WP developers are still working on making WP compatible with PHP 8 and are now calling for testers, meaning you won’t be really able to test PHP8 on your WP site right away. Also, because of the way WP interacts with MySQL, a lot of the waiting time does not come from the PHP compilation, but from the MySQL response time, which cannot be solved with the help of the JIT compiler.  

Code with higher quality 

One of the major differences that you will notice is that many of the warnings and notices that weren’t catchable are now exceptions or errors, which can be caught and logged. It is possible that due to this change, a lot of problems that remained hidden with the previous PHP versions will now surface. This is a great improvement, as it will allow developers to spot potential issues easier. However,  have in mind that it may be a good idea to set display_errors=Off if you decide to use PHP 8 on a live site to not show such errors to your site visitors.

Cleaner, shorter code

Some of the new elements, such as the nullsafe operator, greatly improve the readability of the code, making it shorter and neater.  Instead of nesting several “if’s” you can use the “null” operator to write all those in just 1 line of code. 

The “type” trend

For several versions now, PHP has been trying to define the arguments that each method could adopt and become more of a typed language. In this latest release, there is a feature called “union types” which allows you to define 2 value types for each function, which is a natural continuation of that trend. As the example below shows, the function can return an integer or a float: 

public function getNumber(): int|float {
return $this->number;
}

The list of new features keeps going and we suggest this article as a good reference point for PHP developers:

https://stitcher.io/blog/new-in-php-8
https://stitcher.io/blog/php-jit
https://wiki.php.net/rfc/nullsafe_operator

How to take advantage of PHP 8 on our platform?

All our clients can change the PHP version of their sites from their control panel – For Managed WordPress Clients, Go to your Control Panel, Select PHP Settings, Then change the version – For Shared hosting, cPanel Control Panel –> MultiPHP Manager to change your PHP Version. With PHP8 still being a Release Candidate, we strongly advise that you do not enable it for your live sites, but run tests with it on our staging environment (Staging environments can be created on any plan, If you have trouble doing this, please feel free to reach out to our support team for information on how to do this.), or create copies of your sites in your accounts if you do not have the staging functionality. 

Currently unavailable in PHP 8

The following extensions and modules are not currently available for PHP 8:

Incompatible with PHP 8

The following software currently does not work with PHP 8. This list is not comprehensive.

  • DSO — cPanel & WHM does not support the DSO handler with PHP 8.
  • The XMLRPC extensions — This extension moved to PECL.
  • The JSON extension — This functionality is included in PHP 8 by default.

Tell us what you think and win 6 Months of free hosting

We tried to give you the big picture of what the new PHP8 is all about. Now we would like to hear what you actually think about it, once you get the chance to try it out. What do you like and what do you dislike? How does it work on your website? Do you see any performance improvements? We are looking to explore how our more experienced users take advantage of this early release candidate before it becomes official.

To encourage you to share your tests and opinions with us, We will be giving away 6 months of our Deluxe Shared Hosting service (Normally $9.99 a month) to 10 random users who share their thoughts on PHP8 by December 31, 2020 in a comment under this post, or on Facebook or Twitter, tagging @TheCoreHosting1 and using the hashtag #PHP8 in their post.

Why you should abandon PHP 5.6

PHP 5.6 was a great and very widely used version of PHP. For years developers enjoyed the benefits of the PHP 5 branch and were updated for a long period. But, all good things must come to an end, and as of Jan 1st, 2019, PHP 5.6 has reached E.O.L which stands for End Of Life. This means it is no longer receiving security fixes or updates.

What does this mean for you?

If you’ve been keeping your PHP applications up to date (you should be!) then moving to a new version of PHP should be little to no problem. PHP applications that are being developed on a continual basis, will almost always be supporting the latest in server software. This is especially true for PHP applications.

However, we all have lives away from the screen and we tend to forget about the software we have installed to run our online website/applications. which means they tend to get overlooked when it comes to updates. If you’ve not been keeping your PHP apps up-to-date, then the first thing to do is check with the developer and see if there are updates to the applications you are using. If there are newer versions of your application, then updating your application should be relatively straight forward. Many of today’s PHP applications, such as WordPress, have the ability for automated updates to make moving to a new version fairly straight forward.

No matter what, however, The one thing you should make a top priority is moving away from PHP 5.6. Not moving away from 5.6 could lead to your site and serve being compromised, as security vulnerabilities will, and more than likely already have been found.

Why moving to PHP version 7.1 or higher is the right thing to do.

Speed!

PHP 7 saw a rewrite of the Zend Engine, introducing what is called ZendEngine NextGen, adding one of the largest speed enhancements to PHP applications ever. PHP 7.1 and higher versions add immense performance increases to PHP applications that were running on PHP 5. Most tests conducted show speed improvements of almost double to triple for WordPress and most common CMS applications.

php 5.6

Code compatibility

With a new Major version of PHP (That being 7.x), most application developers will be dropping support for 5.6. In most cases, without upgrading your PHP version, you will be unable to upgrade your application or will have issues if you do. In other words, the transition stage of migrating PHP applications seamlessly from PHP 5 to PHP 7 is closing fast.

Security

As of now, PHP 7.0 has already reached its EOL period and is no longer maintained. But PHP 7.2 does not end its EOL until January 1st, 2021, and PHP 7.3 until January 1st, 2022. This means you will always have security updates and fixes until those times.

How do I move to PHP 7.1 or higher?

That’s the easy part! If you are one of our DIY or Managed WordPress Hosting clients, no need to worry about upgrading because you’re already using the most current version! If you’re hosting with another provider, the best thing to do is to check with their support team to see if they have them available. Alternatively, on Cpanel based systems, you can easily swap version using the build-in MultiPHP version change system.

Motivated to move away from PHP 5.6?

Hopefully, we have helped you to see the benefits of moving away from PHP 5.6. If you want to move away, and either is not able to or do not know how to, then contact us! With our new Managed WordPress Service, we will help maintain, update, secure and optimize your WordPress site, and help the transition process much easier. Or make the migration to us today, We will match or do better than your current pricing! We offer both DIY(Do it Yourself) hosting for those who want to control all aspects of their site, as well as Managed WordPress Hosting where we take care of all the backend work for you! Contact our sales team today!