First we need to enable the Remi php repo.
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
Next we will install yum-utils which is a collection of usefull programs for managing repositories.
yum install yum-utils
Now we can utilize which version of php we want to install. You can choose between the following.
yum-config-manager --enable remi-php70 [Install PHP 7.0] yum-config-manager --enable remi-php71 [Install PHP 7.1] yum-config-manager --enable remi-php72 [Install PHP 7.2] yum-config-manager --enable remi-php73 [Install PHP 7.3]
yum install php php-cli
Remi will installs the following modules as default so no need to install these again. Btw you can allways check what's installed using "php -m"
bz2 calendar core ctype curl date exif fileinfo filter ftp gettext hash iconv json libxml openssl pcntl pcre phar readline reflection session sockets spl standard tokenizer zlib
The list below is an example and does not necessarily reflect your needs.
yum install php-dom php-gd php-imagick php-mbstring php-pdo_mysql php-posix php-simplexml php-soap php-xml php-zip
php -v
Adjust the php.ini located here /etc/php.ini if needed remember to restart apache after you made modifications.