关闭防护墙等
systemctl stop firewalld.servicesystemctl disable firewalld.servicefirewall-cmd --statesed -i \'/^SELINUX=.*/c SELINUX=disabled\' /etc/selinux/configsed -i \'s/^SELINUXTYPE=.*/SELINUXTYPE=disabled/g\' /etc/selinux/configsetenforce 0mkdir -p /app/packmkdir /app/service
安装epel源
yum -y install epel-release
安装PHP可能用到的依赖包等
yum install zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel -yyum install freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel libxslt-devel -yyum -y install libmcrypt-devel mhash #非必须cd /app/pack #有个包会安装不上,因为源里并没有,故手动安装wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.16.tar.gztar xf libiconv-1.16.tar.gz -C /app/service/cd /app/service/libiconv-1.16/./configure --prefix=/app/libiconvmake && make install
下载安装PHP
cd /app/packwget http://mirrors.sohu.com/php/php-7.2.4.tar.gztar xf php-7.2.4.tar.gzcd php-7.2.4./configure --prefix=/app/service/php-7.2.4 --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-iconv-dir=/app/service/libiconv-1.16 --with-freetype-dir --with-jpeg-dir --with-libxml-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbstring --enable-fpm --enable-mbregex --with-gd --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-soap --enable-short-tags --enable-static --with-xsl --with-fpm-user=nginx --with-fpm-group=nginx --enable-ftp --enable-opcache=nomake && make install 会持续漫长的过程,建议进行完后 输入 echo $?
修改部分PHP的配置
cd /app/pack/php-7.2.4ls php.ini-*php.ini-development php.ini-production development是测试版开发版,production 生产版,两个的区别是 测试版里面是打开报错提示的我们将使用测试版,cp php.ini-development /app/service/php/lib/php.inicd /app/service/php/etc/lspear.conf php-fpm.conf.default php-fpm.dcp php-fpm.conf.default php-fpm.confcd php-fpm.dcp www.conf.default www.conf/app/service/php/sbin/php-fpm 启动php
测试 PHP
vi /app/service/nginx/nginx.confhttp {include mime.types;default_type application/octet-stream;include /app/service/nginx/conf.d/*; #添加这一行mkdir -p /app/service/nginx/conf.dvi /app/service/nginx/conf.d/php.confserver {echo \"mysqllisten IP/域名:80;server_name php.test.php;root /test;location ~ \\.php$ {root /test;fastcgi_pass 127.0.0.1:9000;fastcgi_index index.php;include fastcgi.conf;}}mkdir /testecho \"<?php phpinfo(); ?>\" > /test/test_info.php
网页访问
IP/域名/test_info.php注意测试页面完成后一定要删除页面