The much awaited PHP 8.1 is finally here. As contained in our previous announcement which notified you of the depreciation of the Horde mail email interface. PHP 7.4 reached its end-of-Life on November 28, 2022 and PHP 8.1 is already here. Eventually, PHP 7.4 will be deprecated in the cPanel interface. Although cPanel says it will continue to provide security updates for PHP 7.4 until November 2023, the fact is that PHP7.4 is now an outdated software which eventually will no longer be available in subsequent updates to the cPanel control panel. So it's not necessary to postpone the inevitable - upgrading to the latest version of PHP. And there are several benefits you would get from an upgrade.

Previous News

New Measures We Are Taking To Protect Internet Users From Fraudsters

Changes to Our Hosting Plans and Features

 

PHP 8 Benefits

1. Better performance

This feature is not a surprise. Newer software versions come with lots of improvement. The speed performance increase in PHP 8.1 when compared to PHP 7.4 had been up to 26 percent for some content management systems. The biggest performance improvement in PHP 8.1 comes with the Just-In-Time (JIT) compiler. The JIT is an extension for PHP 8 that increases the speed of applications by how  it handles the compilation of PHP scripts. Put simply, it means more complex application code can be executed quicker. This feature is a most welcome development and do have great impact on website speed, User Experience (UX), bounce rate and website ranking.

 

2. New Features

Except you have a good knowledge of the technicalities, most of the new functionalities and how they work will be completely strange. However, we should still provide a basic overview and description.

  • Pure Intersection Types

PHP 8.1 adds support for intersection types. It’s similar to union types introduced in PHP 8.0, but the intended use is just the exact opposite.

  • Enums

PHP 8.1 adds support for enums (also called enumerations or enumerated types). This turns out to be a much desired feature allowing the implementation of a user-defined data type consisting of a set of possible values.

  • The "never" Return Type

PHP 8.1 adds a return type hint called never. This great functionality is used in functions.

  • Fibers

PHP code has almost always been synchronous and this makes it slower. This feature now allows developers to write PHP code asynchronously.

  • New "readonly" Properties

PHP 8.1 adds support for readonly properties which once initialized cannot be undone.

  • Define final Class Constants

With PHP 8.1, you can get stricter to override class constants with its child classes.

  • New fsync() and fdatasync() Functions

PHP 8.1 adds two new file system functions named fsync() and fdatasync(). This addition is most welcome because PHP is one of the major programming languages that still didn’t implement fsync() and fdatasync(). Now, it has been implemented in PHP 8.1.

  • New array_is_list() Function

PHP 8.1 comes with a new array list function. PHP arrays can hold both integer and string keys. That allows you to do several things including lists, hash tables, dictionaries, collections, stacks, queues, and more. You can also have multidimensional  arrays within arrays.

  • New Sodium XChaCha20 Functions

PHP applications use XChaCha20 directly for stream encryption. This has become easier with PHP 8.1, which allows you to have three new functions to encrypt or decrypt data with XChaCha20 without authentication.

Sodium is a modern, easy-to-use cryptographic library for encryption, decryption, password hashing, signatures, and more.

  • New IntlDatePatternGenerator Class

PHP’s underlying ICU library supports the creation of localized date and time formats, but it's not fully customizable. In PHP 8.1+, you can now specify which formats to use for the date, month, and time with the new IntlDatePatternGenerator class.

  • Support for AVIF Image Format

PHP 8.1’s image processing and GD extension adds support for AVIF images. AVIF, or AV1 Image File Format, is a relatively new royalty-free image format based on the AV1 video coding format offering higher compression (and thus smaller file sizes), it also supports several features such as transparency, HDR.

New $_FILES: full_path Key for Directory Uploads

With PHP 8.1, addition of a new key named full_path to the $_FILES array is now easy and you can now store relative paths or duplicate the exact directory structure on the server.

  • Array Unpacking Support for String-Keyed Arrays

PHP 7.4 added support for array unpacking with the array spread operator (…). Although this acted as a quicker alternative to using the array_merge() function, it was limited and conflicts while merging arrays with duplicate keys.

PHP 8 added support for named arguments, removing this limitation.

  • Explicit Octal Numeral Notation

PHP supports various numeral systems, including decimal (base-10), binary (base-2), octal (base-8), and hex (base-16). The decimal numeral system is the default.

If you want to use any other numeral system, you’ll have to prefix each number.

PHP 8.1 now enables you to write in the octal numeral system.

  • MurmurHash3 and xxHash Hash Algorithms Support

PHP 8.1 adds support for MurmurHash3 and xxHash hashing algorithms. They provide good output randomness, dispersion, and uniqueness and are faster than most of PHP’s existing hashing algorithms.

  • DNS-over-HTTPS (DoH) Support

DNS-over-HTTPS (DoH) is a protocol for DNS resolution via the HTTPS protocol. Using HTTPS to encrypt data between the client and DNS resolver, DoH increases user privacy and security by preventing MitM attacks.

PHP 8.1 enables the use of the Curl extension to specify a DoH server.

  • File Uploads from Strings with CURLStringFile

The PHP Curl extension supports HTTP(S) requests with file uploads. It uses the CURLFile class to achieve this, which accepts a URI or a file path, a mime type, and the final file name. But with the CURLFile class, you could only accept the file path or URI, but not the contents of the file itself. In cases where you already had the file being uploaded in the memory (e.g. processed images, XML documents, PDFs), you had to use data:// URIs with Base64 encoding.

PHP 8.1 supports a new CURLStringFile class like libcurl which supports an easier way to accept the file’s contents.

  • New MYSQLI_REFRESH_REPLICA Constant

PHP 8.1’s mysqli extension adds a new constant called MYSQLI_REFRESH_REPLICA. It’s equivalent to the existing MYSQLI_REFRESH_SLAVE constant. This change was welcome in MySQL 8.0.23 to address racial insensitivity in tech vocabulary.

  • Performance Improvements with Inheritance Cache

Inheritance Cache is a new addition to opcache that eliminates PHP class inheritance overhead.

  • First-Class Callable Syntax

PHP 8.1 adds a first-class callable syntax to supersede existing encodings using strings and arrays. This creates a cleaner Closure and is also accessible by static analysis tools and respects the declared scope.

 

3. PHP 8 is More Developer-Friendly

PHP 8.0 is a lot more developer friendly. It gives developers the chance to build better, more robust websites and applications. It adds more consistency, transparency, clarity and efficiency with syntax improvements, great core changes and significant API upgrades, making it more developer-friendly than PHP 7.4.

 

What Does The Depreciation of PHP 7.4 Mean

  • It simply means that it is no longer a recommended piece of software and in most cases, is likely to be removed from cPanel.

  • It also means active development on the feature is discontinued, and therefore, cPanel will no longer be assisting with bug fixes even while it has offered to provide security updates until November 2023. The depreciation is a red flag and a clear warning to all those relying on PHP 7.4 to understand that a vulnerability is possible and cPanel will not be taking responsibility to address new issues.
  • The recommended best practice is to update the software, note and possibly save any customizations. It is a secure and safer practice to migrate to the most recent of software. This is important for security and website performance.

Most of the time, software upgrades come with improved performance in terms of security, speed and search engine performance. It also allows support for new functionalities that are being added to applications and give room for testing new improvements. Running the latest software is therefore always advisable.

 

Frequently Asked Questions

1. Which websites use PHP?

Not every website uses PHP. PHP is used by most of the popular applications like WordPress, Joomla, Drupal, and ecommerce websites. Plain HTML websites do not use PHP.

2. Does the PHP version affect my website speed?

In terms of speed, the latest PHP 8.1 is faster and will boost your website speed better than the PHP 7 series. Some tests have shown a 20 percent boost in website speed after a switch to PHP 8.1.

In terms of functionality, there are many functionalities and newer ones in development that rely on newer PHP versions and are not supported on older PHP versions.

3. I upgraded the PHP version on my website to PHP 8.1 and it created problems

That suggests a compatibility problem. If your website version, its plugins, components, modules and extensions are not all compatible with your PHP version, it can cause errors and functionality problems on your website.

4. When is it safe to upgrade my website PHP version to 8.1?

Before you upgrade, make sure that the web hosting environment supports PHP 8.1. This will require the PHP installation as well as the installation of the Ioncube loaders that support PHP 8.1. You will then need to update your website to a version that supports PHP 8.1. If all your plugins and extensions are compatible with PHP 8.1 and your hosting environment meets the requirements, you should be safe to upgrade your PHP version to 8.1.

If you have any issues with the upgrade process, we suggest you contact your web hosting or your application developers for support.

5. Will my website be at risk if I do not upgrade to PHP 8?

Security updates for PHP 7.4 will continue until November 2023, that means your website will really not be at risk for running on PHP 7.4. However, you will not be able to take advantage of the performance and development features in PHP 8 until you upgrade. We will always advise that you upgrade to the latest software version because it offers the best functionalities and security features.

6. Can my website be affected by a PHP version depreciation?

It will depend on the version of PHP your website is running on and its compatibility with newer PHP versions. If your website relies on PHP and it is not compatible with newer versions of PHP, a depreciation of the version that is compatible with your website version will create an error. The best way to handle this is to update your software to be compatible with the most recent PHP version and update your PHP version as well.

7. How do I switch my PHP version to the most recent version?

You can change your PHP version from the control panel version of your website. You will need to login to cPanel and go to MultiPHP manager. Check the domain for which you want to change the PHP version and from the right corner of the page, select your preferred PHP version. You will get an indication of a successful PHP version switch. If you have difficulties, contact customer support for help.

 



Saturday, February 4, 2023





« Back

Powered by WHMCompleteSolution