linux系统安装PHP

一.先安装vim
sudo yum install vim


.查看 gcc 版本 gcc -v
若无安装,则运行 yum install gcc-c++


.安装php
wget https://www.php.net/distributions/php-7.4.2.tar.gz
tar -zxvf php-7.4.2.tar.gz

cd php-7.4.2/

./configure --prefix=/usr/local/php7


四,配置过程中遇到各种报错信息的处理

1,报错:Package 'libxml-2.0', required by 'virtual:world', not found

    解决:

[root@localhost php-7.4.2]# yum install libxml2-devel

2,报错:Package 'krb5', required by 'virtual:world', not found

   解决:

[root@localhost php-7.4.2]# yum install krb5-devel

3,报错:Package 'openssl', required by 'virtual:world', not found

   解决:

[root@localhost php-7.4.2]# yum install openssl-devel

4,报错:Package 'sqlite3', required by 'virtual:world', not found

   解决:

[root@localhost php-7.4.2]# yum install sqlite-devel

5,报错:Package 'libcurl', required by 'virtual:world', not found

   解决:

[root@localhost php-7.4.2]# yum install libcurl-devel

6,报错:Package 'oniguruma', required by 'virtual:world', not found

   解决:

参见:CentOS 8 安装 oniguruma oniguruma-devel 一文

7,报错:Package 'libxslt', required by 'virtual:world', not found

   解决:

[root@localhost php-7.4.2]# yum install libxslt-devel

8,报错:Package 'libjpeg', required by 'virtual:world', not found

   解决:

[root@localhost php-7.4.2]# yum install libjpeg-devel

9,报错:Package 'libzip', required by 'virtual:world', not found

   解决:

[root@localhost php-7.4.2]# yum install libzip-devel

10,报错:configure: error: Please reinstall the BZip2 distribution

   解决:

[root@yjweb php-7.4.2]# yum -y install bzip2-devel

11,报错:Package 'libpng', required by 'virtual:world', not found

   解决:

[root@yjweb php-7.4.2]# yum install libpng-devel

12,报错:Package 'freetype2', required by 'virtual:world', not found

   解决:

[root@yjweb php-7.4.2]# yum install freetype-devel

五.生成文件
make

make install

到这个地方PHP已经安装成功了,下面是简化PHP语句

原文地址:https://www.cnblogs.com/shiguangliushi/p/14633179.html