12 April 2022

Install PHP 8.0 on CentOS 7

To install PHP 8, you will need to add the EPEL and Remi repositories to your machine.

yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm --import http://download.fedoraproject.org/pub/eprl/RPM-GPG-KEY-EPEL-7

yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
rpm --import https://rpms.remirepo.net/RPM-GPG-KEY-remi

You can verify the repositories were added by using the command below to look for the “php8” packages are there.

sudo yum list php

Install “yum-utils”

sudo yum -y install yum-utils

Enable the Remi repository for PHP, after disabling any existing repo for PHP.

sudo yum-config-manager --disable 'remi-php*'
sudo yum-config-manager --enable remi-php80

Install PHP and all of the required extensions

sudo yum -y install php php-{bcmath,cli,common,curl,devel,gd,imagick,intl,json,mbstring,mcrypt,mysql,mysqlnd,pdo,pear,pecl-apcu,pecl-apcu-devel,ldap,xml,zip}

Verify PHP is installed and the version. You can see I was able to install PHP v8.0.17

sudo php -v

Open the php.ini config file and set your timezone. You will need to uncomment the line for date.timezone and set it to your timezone of choice.

sudo vi /etc/php.ini
date.timezone = Pacific/Honolulu

Tags: , , , , ,
Copyright 2022. All rights reserved.

Posted April 12, 2022 by IT.PWWF in category "CentOS", "Linux", "Software

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.