CentOS7.4纯净版系统编译安装php-fpm

安装依赖

yum install gcc bison bison-devel zlib-devel libmcrypt-devel mcrypt mhash-devel openssl-devel libxml2-devel libcurl-devel bzip2-devel readline-devel libedit-devel sqlite-devel

 

下载php

http://php.net/get/php-5.6.39.tar.gz/from/a/mirror

 

安装报错configure: error: png.h not found

没有安装对应包 yum -y install libpng libpng-devel

经常会遇到此类问题,处理办法就是安装对应包

 

安装好后  cp php.ini-production /usr/local/php/etc/php.ini

 

cd /usr/local/php
cp etc/php-fpm.conf.default etc/php-fpm.conf
vim etc/php-fpm.conf

修改必要的参数 

user = www
group = www

如果www用户不存在,那么先添加www用户

groupadd www
useradd -g www www

启动php-fpm
/usr/local/php/sbin/php-fpm

OK!

下一步 nginx整合php-fpm
之前nginx安装在/www/nginx目录的
修改/www/nginx/conf/nginx.conf 配置文件
最后添加  include /home/vhost/*.conf;

这样设置的目录是把站点配置文件放到home盘,一个站点一个文件便于统一查看处理。
添加测试站点/home/vhost/目录添加测试站点文件test.conf


server {
        listen       80;
        root /home/wwwroot/test;
        server_name test.com;
        index  index.html index.php index.htm;
        error_page  400 /errpage/400.html;
        error_page  403 /errpage/403.html;
        error_page  404 /errpage/404.html;
        error_page  503 /errpage/503.html;
        location ~ \.php(.*)$ {
                fastcgi_pass  127.0.0.1:9000;
                fastcgi_index  index.php;
                #fastcgi_param  SCRIPT_FILENAME  $DOCUMENT_ROOT$fastcgi_script_name;
                #fastcgi_param PATH_INFO $2;
                include fcgi.conf;
        }
        location ~ /\.ht {
                deny  all;
        }
        location / {
                 try_files $uri $uri/ /?$args;
        }
        access_log  /home/logs/testcom_access.log  main;
}






 

 

 

 

 

About sun 83 Articles
85后青年,自诩为伪文艺青年

Be the first to comment

Leave a Reply

Your email address will not be published.


*