The latest version of PHP 8.0 just released few day ago. PHP 8 is the greatest PHP version right know, if you use PHP as your main dev language the 8.0 has many advantages over 7.x version.
Few advantages of PHP 8.0
– Named arguments
– Attributes
– Constructor property promotion
– Union types
– Match expression
– Nullsafe operator
– Saner string to number comparisons
– Consistent type errors for internal functions
– JIT
the saner string to number comparison maybe the good and bad things, I saw a lot of error due to 0 == 'foobar' // false
when using PHP 8 for our internal project. Let’s start the tutorial on how to install PHP 8.0 on CentOS 8 from the beginning.
Keep CentOS 8 Updated
Keep the os updated by updating it regularly
yum update -y
Install EPEL Repository
Install EPEL repository
sudo dnf install epel-release -y
Install Remi Repository
For our PHP 8.0 we’ll use REMI repo which already had PHP 8.0, since CentOS 8 wont add support for PHP 8.
sudo dnf install https://rpms.remirepo.net/enterprise/remi-release-8.rpm -y
Install PHP 8.0
Install PHP 8.0 on CentOS 8
sudo yum install php80-php php80-php-cli php80-php-gd php80-php-fpm \ php80-php-curl php80-php-intl php80-php-mysqlnd php80-php-zip php80-php-xml \ php80-php-mbstring php80-php-bcmath -y
depend on what you need on your application, you might need to install some other module using format php80-php-xxx where xxx is package/module name.
check PHP version using php80 --version