Apache & PHP
Save yourself a lot of hassle and use Remi's RPM repository to ensure you have a well curated and up-to-date versions of Apache and PHP.
This is very easy. follow Remi's Configuration guide: https://rpms.remirepo.net/wizard/
Q: Which EL version do I choose?
A: Pick the EL version that matches your distro's version. For example if you are running Rocky Linux 8, choose EL 8.
Then just follow the commands provided by Remi to install the Repos and packages.
Once you've added Remi and followed all the commands, here's my recommended PHP install command to get all the most commonly needed PHP modules:
dnf install git libssh2 libssh2-devel ftp php php-json php-opcache php-gd php-intl php-mbstring php-mysqlnd php-pdo php-soap php-xml php-gmp php-sodium php-pear php-pecl-memcached php-pecl-mcrypt php-pecl-ssh2 php-pecl-zip php-pecl-mongodb memcached
This will Install:
- git - Everyone needs git
- libssh - For SSH connections
- ftp - Sometimes you need to ftp. You can remove this if you really don't want it
- memcached - Not all projects will need/use memcache, so this is optional
- php-mysqlnd, php-pdo, php-pecl-mongodb - Handles most of the DB connection types you will need
- Lots of other useful PHP modules for things like multi-byte support, xml, encryption, international, zip, and several others
You can always add or remove any PHP modules you do/don't want at any time.