php-5.6.31安装

cd /usr/local/src/

wget http://cn2.php.net/distributions/php-5.6.31.tar.bz2


tar jxf php-5.6.31.tar.bz2
cd php-5.6.31


./configure --prefix=/srv/php-5.6.31 \
--with-config-file-path=/srv/php-5.6.31/etc \
--with-config-file-scan-dir=/srv/php-5.6.31/etc/conf.d \
--enable-fpm \
--with-fpm-user=www \
--with-fpm-group=www \
--with-pear \
--with-curl \
--with-gd \
--with-jpeg-dir \
--with-png-dir \
--with-freetype-dir \
--with-zlib-dir \
--with-iconv \
--with-mcrypt \
--with-mhash \
--with-pdo-mysql \
--with-mysql-sock=/var/lib/mysql/mysql.sock \
--with-mysqli=/usr/bin/mysql_config \
--with-pdo-pgsql=/usr/pgsql-9.3 \
--with-openssl \
--with-xsl \
--with-recode \
--enable-sockets \
--enable-soap \
--enable-mbstring \
--enable-exif \
--enable-gd-native-ttf \
--enable-zip \
--enable-xml \
--enable-bcmath \
--enable-calendar \
--enable-shmop \
--enable-dba \
--enable-wddx \
--enable-sysvsem \
--enable-sysvshm \
--enable-sysvmsg \
--enable-opcache \
--enable-pcntl \
--enable-maintainer-zts \
--with-tsrm-pthreads \
--disable-debug




make -j8




make install






strip /srv/php-5.6.31/bin/php
strip /srv/php-5.6.31/bin/php-cgi


mkdir -p /srv/php-5.6.31/etc/conf.d
mkdir -p /srv/php-5.6.31/etc/fpm.d
cp /srv/php-5.6.31/etc/pear.conf{,.original}
cp php.ini-* /srv/php-5.6.31/etc/
cp /srv/php-5.6.31/etc/php.ini-production /srv/php-5.6.31/etc/php.ini
cp /srv/php-5.6.31/etc/php.ini-development /srv/php-5.6.31/etc/php.cli.ini
cp /srv/php-5.6.31/etc/php-fpm.conf.default /srv/php-5.6.31/etc/php-fpm.conf


yes|cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod +x /etc/init.d/php-fpm
chkconfig --add php-fpm
chkconfig php-fpm on


rm -f /srv/php
ln -s /srv/php-5.6.31/ /srv/php


vim /srv/php-5.6.31/etc/php-fpm.conf < /dev/null 2>&1
:25,25s/;//
:32,32s/;//
:93,93s/;rlimit_files = 1024/rlimit_files = 65536/
:225,225s/pm.max_children = 5/pm.max_children = 2048/
:251,251s/;pm.max_requests = 500/pm.max_requests = 1024/
:448,448s/;rlimit_files = 1024/rlimit_files = 40960/
:wq
end


vim /srv/php-5.6.31/etc/php.ini < /dev/null 2>&1
:299,299s$;open_basedir =$open_basedir = /www/:/tmp/:/var/tmp/:/srv/php-5.6.31/lib/php/:/srv/php-5.6.31/bin/$
:366,366s/expose_php = On/expose_php = Off/
:396,396s/memory_limit = 128M/memory_limit = 32M/
:758,758s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=1/
:913,913s:;date.timezone =:date.timezone = Asia/Hong_Kong:
:1390,1390s:;session.save_path = "/tmp":session.save_path = "/dev/shm":
:1416,1416s/session.name = PHPSESSID/session.name = JSESSIONID/
:wq
EOF


vim /srv/php-5.6.31/etc/php.cli.ini < /dev/null 2>&1
:396,396s/memory_limit = 128M/memory_limit = 4G/
:575,575s/;//
:913,913s:;date.timezone =:date.timezone = Asia/Hong_Kong:
:wq
EOF


cat >> ~/.bashrc <<'EOF'
alias php='php -c /srv/php/etc/php.cli.ini'
PATH=$PATH:/srv/php/bin
EOF


/etc/init.d/php-fpm start

你可能感兴趣的:(PHP)