安装前准备
yum -y install gcc automake autoconf libtool make yum -y install gcc gcc-c++ glibc 以上已经安装了可以不用安装 yum -y install libmcrypt-devel mhash-devel libxslt-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel sqlite-devel sqlite
1. wget https://github.com/kkos/oniguruma/archive/v6.9.4.tar.gz -O oniguruma-6.9.4.tar.gz
如果出现以上这种情况:请参照下面的做法
写入格式:
140.82.114.4 github.com
如果不是github.com 可以访问网站:ipaddress.com 输入对应得网址查出它的IP,再按照上面的格式写入即可。
2. tar -xvf oniguruma-6.9.4.tar.gz 3. cd oniguruma-6.9.4/ 4. ./autogen.sh 5. ./configure --prefix=/usr --libdir=/lib64 6. make && make install
安装php-fpm
cd /home wget https://mirrors.sohu.com/php/php-7.4.16.tar.gz cd php-7.4.16 ./configure --prefix=/usr/local/php --enable-fpm --with-mcrypt --enable-mbstring --disable-pdo --with-curl --disable-debug --disable-rpath --enable-inline-optimization --with-bz2 --with-zlib --enable-sockets --enable-sysvsem --enable-sysvshm --enable-pcntl --enable-mbregex --with-mhash --enable-zip --with-pcre-regex --with-mysql --with-mysqli --with-gd --with-jpeg-dir make all install
安装完成之后,需要生成php-fpm配置文件
cd /usr/local/php cp etc/php-fpm.conf.default etc/php-fpm.conf cd /usr/local/php/etc/php-fpm.d cp www.conf.default www.conf
配置nginx.conf ,使nginx将php动态请求发送到PHP解释器处理
如果没有安装nginx 请 前往 nginx安装和环境搭建 安装.
location ~ .php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param script_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
测试
在/usr/local/nginx/html下创建index.php文件,输入如下内容
启动php-fpm
/usr/local/php/sbin/php-fpm
浏览器访问



