PHP is one of the most popular and widely used programming languages for web development. It offers many features and benefits, such as:

  • Easy integration with HTML, CSS, and JavaScript
  • Support for various databases and servers
  • Large and active community of developers
  • Open-source and free to use

However, PHP is also constantly evolving and improving, which means that new versions are released regularly. These new versions introduce new features, fix bugs, and enhance performance and security. Therefore, it is important to keep your PHP version up to date, especially if you are running web applications that depend on PHP, such as WordPress and Nextcloud.

In this blog post, we will show you how to upgrade PHP on Rocky Linux 9 from PHP 8.0 to 8.1, which is the latest stable version of PHP as of November 2021. We will also highlight the compatibility of WordPress and Nextcloud with PHP 8.1, and the benefits of upgrading PHP on your system stability and performance.

What’s New in PHP 8.1?

PHP 8.1 was released on November 25, 2021, and it brings some new features and improvements, such as12:

  • Enumerations: A new way to define a set of named constants that can be used as a type or a value
  • Fibers: A new mechanism to write asynchronous code in a synchronous way, using coroutines
  • Readonly Properties: A new modifier to declare class properties that cannot be modified after initialization
  • Intersection Types: A new way to combine multiple types into one, using the & operator
  • New Functions and Classes: Such as ini_parse_quantity, curl_upkeep, openssl_cipher_key_length, memory_reset_peak_usage, and more
  • Deprecated Features: Such as dynamic properties, utf8_encode and utf8_decode functions, and more

These new features and improvements aim to make PHP more expressive, consistent, and performant. They also enable developers to write cleaner, safer, and more efficient code.

How to Upgrade PHP on Rocky Linux 9 from PHP 8.0 to 8.1?

To upgrade PHP on Rocky Linux 9 from PHP 8.0 to 8.1, we will use the Remi PHP repository, which provides various PHP versions for Rocky Linux and other RHEL-based distributions3. The Remi PHP repository allows you to easily install and switch between different PHP versions on your system.

Before upgrading PHP, make sure to backup your web applications and data, and test the compatibility of your code with PHP 8.1 on a staging or development environment. Some features and syntax elements may have changed or been deprecated in PHP 8.1, so you may need to update your code accordingly.

To upgrade PHP on Rocky Linux 9 from PHP 8.0 to 8.1, follow these steps:

  1. Update your system with the command: sudo dnf upgrade --refresh
  2. Install the Remi PHP repository, which provides various PHP versions for Rocky Linux. To do so, run the following command: sudo dnf install https://rpms.remirepo.net/enterprise/remi-release-9.rpm
  3. Enable the PHP 8.1 module from the Remi repository with the command: sudo dnf module enable php:remi-8.1
  4. Install PHP 8.1 and the desired extensions with the command: sudo dnf install php php-fpm php-mysqlnd php-opcache php-gd php-xml php-mbstring
  5. Start and enable the PHP-FPM service with the command: sudo systemctl enable --now php-fpm
  6. Verify your PHP version with the command: php -v

You should now have PHP 8.1 installed on your Rocky Linux 9 system. If you are using a web server such as Apache or Nginx, you need to configure it to use PHP-FPM accordingly.

How to Check the Compatibility of WordPress and Nextcloud with PHP 8.1?

WordPress and Nextcloud are two popular web applications that run on PHP. WordPress is a content management system that powers over 40% of the web, and Nextcloud is a cloud storage and collaboration platform that allows you to host your own data and services.

Both WordPress and Nextcloud support PHP 8.1, but you may need to check the compatibility of your plugins, themes, and configurations before upgrading PHP. Some plugins and themes may not be compatible with PHP 8.1, or may require updates to work properly. You may also need to adjust some settings or parameters to optimize the performance and security of your web applications.

To check the compatibility of WordPress and Nextcloud with PHP 8.1, you can use the following tools and resources:

  • WordPress PHP Compatibility Checker: A plugin that scans your WordPress site and reports any potential issues with PHP 8.1
  • WordPress PHP Requirements: A page that lists the minimum and recommended PHP versions for WordPress and its components
  • Nextcloud System Requirements: A page that lists the minimum and recommended PHP versions for Nextcloud and its components
  • Nextcloud PHP Compatibility: A page that lists the compatibility of Nextcloud with different PHP versions and features

By using these tools and resources, you can ensure that your WordPress and Nextcloud sites are ready to run on PHP 8.1, and avoid any errors or problems.

What are the Benefits of Upgrading PHP on System Stability and Performance?

Upgrading PHP on your system can have several benefits for your system stability and performance, such as:

  • Improved Security: PHP 8.1 fixes some security issues and vulnerabilities that were present in previous versions, and introduces new features to enhance the security of your code, such as readonly properties, sensitive parameter value redaction, and more
  • Improved Performance: PHP 8.1 improves the performance and efficiency of your code, by using less memory, reducing CPU usage, and speeding up execution time. PHP 8.1 also introduces new features to optimize the performance of your code, such as fibers, JIT compiler, and more
  • Improved Compatibility: PHP 8.1 improves the compatibility and interoperability of your code, by supporting new features and standards, such as enumerations, intersection types, and more. PHP 8.1 also improves the compatibility of your code with other languages and frameworks, such as JavaScript, TypeScript, and Laravel

By upgrading PHP on your system, you can enjoy these benefits and more, and make your web applications more secure, fast, and reliable.

Conclusion

In this blog post, we have shown you how to upgrade PHP on Rocky Linux 9 from PHP 8.0 to 8.1, and highlighted the compatibility of WordPress and Nextcloud with PHP 8.1. We have also discussed the benefits of upgrading PHP on your system stability and performance.

We hope you have found this blog post helpful and informative. If you have any questions or feedback, please feel free to leave a comment below. Thank you for reading! 😊


Useful Links for further reading:

How to Upgrade PHP on Rocky Linux 9 from PHP 8.0 to 8.1

Johannes Rest


.NET Architekt und Entwickler


Beitragsnavigation


Ein Gedanke zu „How to Upgrade PHP on Rocky Linux 9 from PHP 8.0 to 8.1

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert