Skip to content

Compile and install PHP 5.6 on CentOS 6.x

CentOS 6.x 编译PHP 5.6

1 prepare gcc

yum install gcc gcc-c++ pcre* openssl* gd-devel* libxml2-devel bzip2-devel libcurl-devel

2 download PHP 5.6.16

wget http://php.net/distributions/php-5.6.16.tar.gz

3 uncompress

tar -zxvf php-5.6.16.tar.gz
cd php-5.6.16

4 compile

./configure \
--prefix=/usr/local/php \
--with-zlib \
--with-openssl \
--with-mysql \
--with-mysqli \
--with-gd \
--with-curl \
--with-bz2 \
--with-zlib \
--with-jpeg-dir \
--with-mhash \
--enable-fpm \
--enable-sockets \
--enable-inline-optimization \
--enable-mbstring \
--enable-sysvsem \
--enable-pcntl \
--enable-mbregex \
--disable-debug \
--disable-pdo \
--disable-rpath

5 install

make
make install

6 change config file

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

7 start php-fpm

/usr/local/php/sbin/php-fpm

8 stop php-fpm

pkill php-fpm

Disclaimer
  1. License under CC BY-NC 4.0
  2. Copyright issue feedback me#imzye.me, replace # with @
  3. Not all the commands and scripts are tested in production environment, use at your own risk
  4. No privacy information is collected here
Try iOS App