How to add PHP 8.1 to CloudPanel?
PHP 8.1 is a major update of the PHP language. It contains many new feature like:
- Enumerations
- Readonly Properties
- First-class Callable Syntax
- New in initializers
- Pure Intersection Types
- Never return type
- Final class constants
- Fibers
- Performance improvements and more
In this tutorial, I will explain how to add PHP 8.1 to your existing CloudPanel installation. The newest CloudPanel version is being shipped with PHP 8.1.
Installation
Before you start with the installation, make sure to make a backup of the server in case of an unexpected error.
- First, we need to add the PHP 8.1 package sources:
nano /etc/apt/sources.list.d/packages.cloudpanel.io.list
Add the following lines after the PHP 8.0:
deb https://d17k9fuiwb52nc.cloudfront.net/ buster php-8.1
deb-src https://d17k9fuiwb52nc.cloudfront.net/ buster php-8.1
- Update the package sources:
apt update
- Install PHP 8.1 packages:
apt-get install -y php8.1-common php8.1-fpm php8.1 php8.1-zip php8.1-soap php8.1-opcache php8.1-mysql php8.1-cli php8.1-gd php8.1-curl php8.1-xsl php8.1-imap php8.1-intl php8.1-sqlite3 php8.1-bcmath php8.1-mbstring php8.1-readline
Done
That's it, you can now use PHP 8.1 in your CloudPanel.