编译安装php56 线程安全要加装pthread

wget http://cn2.php.net/get/php-5.6.22.tar.gz/from/this/mirror

tar zxvf php-5.6.22.tar.gz

cd php-5.6.22

./configure --prefix=/usr/local/php5622 --enable-maintainer-zts --with-config-file-path=/usr/local/php5622/etc --enable-fpm --with-fpm-user=php-fpm --with-fpm-group=www --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --enable-opcache --enable-mbstring --enable-soap --enable-zip --enable-bcmath--with-openssl --with-zlib --with-curl --with-gd --with-zlib-dir=/usr/lib--with-png-dir=/usr/lib --with-jpeg-dir=/usr/lib --with-mhash--with-apxs2=/usr/local/apache/bin/apxs

make
make install

添加软连接

添加 php-fpm用户
adduser php-fpm
groupadd www

php-fpm
复制默认配置文件
cp /usr/local/php5622/etc/php-fpm.conf.default /usr/local/php5622/etc/php-fpm.conf

cp /usr/local/src/php-5.6.22/php.ini-production /usr/local/php5622/etc/php.ini

增加启动脚本
http://coder.weisiliang.com/co_index.action?coid=38

增加memcache支持

http://pecl.php.net/package/memcache
wget http://pecl.php.net/get/memcache-3.0.8.tgz
tar zxvf memcache-3.0.8.tgz
cd memcache-3.0.8
phpize56
./configure --with-php-config=/usr/local/php5622/bin/php-config
make
make install

libmemcached
wget https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz
tar zxvf libmemcached-1.0.18.tar.gz
cd libmemcached-1.0.18
./configure --prefix=/usr/local/libmemcached
make
make install

memcached php ext
wget http://pecl.php.net/get/memcached-2.2.0.tgz
tar zxvf memcached-2.2.0.tgz
cd memcached-2.2.0
phpize56
./configure --with-php-config=/usr/local/php5622/bin/php-config --with-libmemcached-dir=/usr/local/libmemcached --disable-memcached-sasl
make
make install

pthread 安装

centos php5.6是yum安装的
pthread2.x支持php5
3.x支持php7
下载:
wget http://pecl.php.net/get/pthreads-2.0.10.tgz

tar zxvf pthreads-2.0.10.tgz

cd pthreads-2.0.10

安装phpize

yum install php56-php-devel

默认没加关联,需要增加快捷方式

ln -s /opt/remi/php56/root/usr/bin/phpize /usr/bin/phpize
ln -s /opt/remi/php56/root/usr/bin/php-config /usr/bin/php-config

phpize

编译

./configure --with-php-config=/usr/bin/php-config

提示:
checking checking for ZTS… configure: error: pthreads requires ZTS, please re-compile PHP with ZTS enabled

我擦,我找的3方源php56是非线程安全的….擦擦擦

重新编译安装后
#编译安装php关联

ln -s /usr/local/php5622/bin/phpize /usr/bin/phpize56

./configure --with-php-config=/usr/local/php5622/bin/php-config

make
make install

php.ini中增加
extension=pthreads.so

php56 -i |grep pthreads -A 5

成功打印pthread 版本