CentOS7.8 uses yum to install PHP 7.4

The server is centos7.8 of Alibaba Cloud.

The PHP version installed before is 7.2, but the laravel8 framework requires the PHP version to be greater than 7.3

I tried to compile and install it here, but the compiled and installed PHP-GD library extension does not support jpeg, and it does not solve this problem at present.

Therefore, I use yum to install PHP7.4 first.

1. Add EPEL and REMI repository

Run the following command to add the required repositories:

sudo yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo yum -y install https://rpms.remirepo.net/enterprise/remi-release-7.rpm

2. Install PHP 7.4 version on CentOS 7

We can now enable the PHP 7.4 Remi repository and install PHP 7.4 on CentOS 7:

sudo yum -y install yum-utils
sudo yum-config-manager --enable remi-php74

Install PHP 7.4 on CentOS 7:

sudo yum update
sudo yum install php php-cli

Use the next command to install other packages:

sudo yum install php-xxx

For example, run the following command:

sudo yum install php  php-cli php-fpm php-mysqlnd php-zip php-devel php-gd php-mcrypt php-mbstring php-curl php-xml php-pear php-bcmath php-json

The current PHP version should be version 7.4, as shown below:

[root@VM_0_4_centos ~]# php -v
PHP 7.4.13 (cli) (built: Nov 24 2020 10:03:34) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies

If you want to view the enabled modules, run:

php -m

Have a good suggestion, please enter your comment below.

Welcome to personal blog
https://guanchao.site

Welcome to the Mini Program:
Insert picture description here

Guess you like

Origin blog.csdn.net/qq_39708228/article/details/113538867