我的php5.6安装报在 /usr/locl/src目录下面
添加 epel 源
rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
安装依赖
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
yum -y install gcc gcc-c++ glibc
安装php依赖 (有的系统可能会报错,不支持这个写法,那就一个一个来,别着急。)
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
cd /usr/local/src
wget http://php.net/get/php-5.6.30.tar.gz/from/this/mirror
tar -zvxf php-5.6.30.tar.gz
cd php-5.6.30
开始配置,一定要加上openssl 要不然即使安装成了,phpinfo里面没有openssl扩展,还得【重新编译php安装openssl 扩展】https://www.cnblogs.com/njr8/p/5748189.html
./configure --prefix=/usr/local/php --enable-fpm --with-mcrypt
--enable-mbstring --enable-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 --with-freetype-dir --enable-calendar --with-pdo-mysql --with-openssl
make && make install
配置 php.ini
cp php.ini-production /usr/local/php/etc/php.ini
配置 php-fpm
1 cd /usr/local/php
2 cp etc/php-fpm.conf.default etc/php-fpm.conf
3 vim etc/php-fpm.conf
修改
user = www
group = www
删除pid前面的; 并修改成
pid = /usr/local/php/var/run/php-fpm.pid
pm.max_children = 150
pm.start_servers = 8
pm.min_spare_servers = 5
pm.max_spare_servers = 10
添加用户组:
groupadd www
useradd -g www www
最后启动php-fpm
usr/local/php/sbin/php-fpm