Chinaunix首页 | 论坛 | 博客
  • 博客访问: 220954
  • 博文数量: 70
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 440
  • 用 户 组: 普通用户
  • 注册时间: 2015-08-09 09:16
个人简介

淡泊以明志,宁静以致远。

文章分类

全部博文(70)

分类: LINUX

2017-11-25 23:32:12

1、安装编译需要的库
yum -y install make gcc libjpeg libjpeg-devel libpng libpng-devel libpng10 libpng10-devel gd gd-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glib2 glib2-devel bzip2 bzip2-devel libevent libevent-devel ncurses ncurses-devel  krb5 krb5-devel libidn libidn-devel openssl openssl-devel gettext gettext-devel  gmp-devel pspell-devel curl-devel


2、因为部分包官方源没有,所以添加 epel 源进行安装(选择系统对应版本下载)
wget -O /etc/yum.repos.d/epel.repo 
yum install libmcrypt-devel libmcrypt mhash mcrypt -y           


3、还有一个yum安装不了的,用源码安装吧
wget 
tar zxvf libiconv-1.14.tar.gz
cd libiconv-1.14
./configure --prefix=/usr/local/libiconv
make && make install


4、接下来正式安装php(解压,编译,安装,拷贝配置文件,创建用户)
tar zxvf php-5.6.30.tar.gz 
cd php-5.6.30
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath  --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --with-mcrypt --enable-ftp --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --disable-fileinfo --enable-maintainer-zts
make && make install
cp php.ini-production /usr/local/php/etc/php.ini
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod +x /etc/init.d/php-fpm
chkconfig php-fpm on
useradd -s /sbin/nologin -M www(因为在编译php是指定了用户和组,所以要创建)
/etc/init.d/php-fpm start

5、修改nginx配置文件使之支持php
vim /usr/local/nginx/conf/nginx.conf(找到自己环境的nginx配置文件)

找到下面的这段,把其

#location ~ \.php$ {

#    root           html;

#    fastcgi_pass   127.0.0.1:9000;

#    fastcgi_index  index.php;

#    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;

#    include        fastcgi_params;

#}

修改为

location ~ \.php$ {

    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/sbin/nginx -t

平滑重启:/usr/local/nginx/sbin/nginx -s reload

转载自:

阅读(1405) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~