Back to Blog

PHP 8.0 Available for Cloud Containers

/ Cloud Containers
PHP 8.0 is out now for Cloud Containers, and there's a few things to know before you dive in.
PHP8 logo.

Today we are pleased to announce general availability of SiteHost's Cloud Container images for Apache and Nginx with PHP 8.0. PHP 8.0 is a major update of the PHP language, containing many new features and optimisations. Being a new release however there are some things to keep in mind before switching.

What's new?

There's a lot of new features in PHP 8, including improvements to the type systems and error handling as well as some useful new string and match functions. We've detailed some of this below, and you can also read more about them at the official PHP website.

Because this is a new release, not all extensions are available as of yet. Ones to note are:

  • New Relic
    A PHP 8.0 compatible version of this extension is likely to only be available by January 2021

  • ionCube
    Based on previous major releases, a PHP 8.0 compatible version of this extension is unlikely to be available before June 2021.

  • xmlrpc
    This extension has been deprecated and unbundled as of PHP 8.0, with no ETA on PECL module availability.

PHP 8.0 is a new major version which introduces a few breaking changes as well as many new features and performance improvements. Due to the breaking changes there is a reasonable probability that you will need to make some adjustments to your code to get it running on PHP 8.0. Most major CMSes support PHP 8.0 but some third party plugins may not be fully compatible as of yet - if in doubt, check with the CMS or plugin provider.

If you’re ready to dive in and give it a go, you can spin up a PHP 8.0 container on your Cloud Container server today, with either Nginx or Apache, via the SiteHost Control Panel.

For those of you that are technically minded, here's some of the big changes in PHP 8:

  • Named Arguments
    Named arguments let you pass in values to a function with the value name, regardless of the order of the parameters, as well as allowing you to skip optional parameters.

  • Union Types
    A collection of two or more types which indicate that either one of the types can be used.

  • Attributes
    Commonly known as annotations in other languages, attributes give you a way to add metadata to classes in a standardised approach.

  • Constructor Property Promotion
    Rather than specifying class properties and a constructor for them, you can now combine them into one definition.

  • Match Expression
    An "upgrade" to the 'switch' expression - with 'match' you can return values, not require break statements, combine conditions, and use strict type comparison.

  • Nullsafe Operator
    Clean up your null comparison blocks into one clean line.

  • JIT Compiler
    Potential significant performance improvements in certain long-running functions, though not always within the context of web requests.

  • General improvements in the type system, error handling, and consistency.