To install PHP 7.4 on CentOS 7, you can follow these steps. Before you start, it’s recommended to update your system to ensure that you have the latest packages. Open a terminal and run the following commands:
Now, you can install PHP 7.4 using the Remi repository, which provides up-to-date PHP versions for CentOS. Follow these steps:
1. Install the EPEL repository:
sudo yum install epel-release
2. Install the Remi repository:
sudo yum install -y https://rpms.remirepo.net/enterprise/remi-release-7.rpm
3. Enable the Remi repository:
sudo yum-config-manager --enable remi-php74
4. Install PHP 7.4 and necessary modules:
sudo yum install php php-opcache php-cli php-fpm php-mysql php-gd php-ldap php-odbc php-pdo php-pecl-apcu php-pecl-apcu-devel php-mbstring php-mcrypt php-xml php-xmlrpc php-soap php-intl php-json php-imagick
5. Verify the PHP installation:
php -v
This should display information about PHP 7.4.
6. Start and enable the PHP-FPM service:
sudo systemctl start php-fpm
sudo systemctl enable php-fpm
For Nginx, you’ll need to configure Nginx to use PHP-FPM. This involves updating your Nginx configuration files.