码迷,mamicode.com
首页 > Web开发 > 详细

PHP环境部署

时间:2020-07-19 13:54:19      阅读:103      评论:0      收藏:0      [点我收藏+]

标签:php   emctl   dir   stat   ibm   shm   configure   group   www   

关闭防护墙等

systemctl stop firewalld.service
systemctl disable firewalld.service
firewall-cmd --state
sed -i ‘/^SELINUX=.*/c SELINUX=disabled‘ /etc/selinux/config
sed -i ‘s/^SELINUXTYPE=.*/SELINUXTYPE=disabled/g‘ /etc/selinux/config
setenforce 0
mkdir -p /app/pack
mkdir /app/service

安装epel源

yum  -y install epel-release

安装PHP可能用到的依赖包等

yum install zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel -y 
yum install freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel libxslt-devel -y
yum -y install libmcrypt-devel mhash #非必须 
cd /app/pack  #有个包会安装不上,因为源里并没有,故手动安装
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.16.tar.gz
tar xf libiconv-1.16.tar.gz -C /app/service/ 
cd /app/service/libiconv-1.16/ 
./configure --prefix=/app/libiconv 
make && make install

下载安装PHP

cd /app/pack
wget http://mirrors.sohu.com/php/php-7.2.4.tar.gz
tar xf php-7.2.4.tar.gz
cd 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=no
make && make install  会持续漫长的过程,建议进行完后 输入 echo $?

修改部分PHP的配置

cd /app/pack/php-7.2.4
ls php.ini-*
php.ini-development  php.ini-production development是测试版开发版,production 生产版,两个的区别是 测试版里面是打开报错提示的
我们将使用测试版,
cp php.ini-development /app/service/php/lib/php.ini

cd /app/service/php/etc/ 
ls
pear.conf  php-fpm.conf.default  php-fpm.d
cp php-fpm.conf.default php-fpm.conf
cd php-fpm.d
cp www.conf.default www.conf
/app/service/php/sbin/php-fpm 启动php

测试 PHP

vi /app/service/nginx/nginx.conf
http {
    include       mime.types;
    default_type  application/octet-stream;
    include     /app/service/nginx/conf.d/*;         #添加这一行
mkdir -p /app/service/nginx/conf.d

vi /app/service/nginx/conf.d/php.conf
server {
                echo "mysql 
    listen 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 /test
echo "<?php phpinfo(); ?>" > /test/test_info.php

网页访问

IP/域名/test_info.php

注意测试页面完成后一定要删除页面

技术图片

PHP环境部署

标签:php   emctl   dir   stat   ibm   shm   configure   group   www   

原文地址:https://blog.51cto.com/14834890/2511681

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!