CentOS 8
https://www.tecmint.com/install-php-on-centos-8/
Then install these packages:
dnf install php-gd php-ldap php-mysqlnd php-pecl-mcrypt php-pecl-zip
Then remove these packages:
dnf remove php-fpm
CentOS 7
Use this link but substitute in 7.4 for the desired release to activate.
Look at Remi's RPM repository blog
After the install, these PHP packages should be on the system:
php-7.4.33-2.el7.remi.x86_64 php-cli-7.4.33-2.el7.remi.x86_64 php-common-7.4.33-2.el7.remi.x86_64 php-json-7.4.33-2.el7.remi.x86_64 php-mbstring-7.4.33-2.el7.remi.x86_64 php-mysqlnd-7.4.33-2.el7.remi.x86_64 php-pdo-7.4.33-2.el7.remi.x86_64 php-pecl-mcrypt-1.0.5-1.el7.remi.7.4.x86_64 php-sodium-7.4.33-2.el7.remi.x86_64 php-xml-7.4.33-2.el7.remi.x86_64
Remember to merge in local changes to /etc/php.ini