原文章:https://blog.csdn.net/weixin_42135441/article/details/82743893
1.下载php5.4和pthreads并解压。
# wget http://www.php.net/distributions/php-5.4.36.tar.gz
# wget http://pecl.php.net/get/pthreads-1.0.0.tgz
# tar zxvf php-5.4.36.tar.gz
# tar zxvf pthreads-1.0.0.tgz
2. 将 解压的 pthreads-1.0.0放入php-5.4.36下的ext目录下
# mv pthreads-1.0.0 php-5.4.36/ext
3.重新配置资源
# cd php-5.4.36
# ./buildconf --force
查看一下是否已经有pthreads
# ./configure --help | grep pthreads
如果没有,执行下面命令重新配置
# rm -rf aclocal.m4
# rm -rf autom4te.cache/
# ./configure --help | grep pthreads
4.配置需要一起安装的拓展
# ./configure --enable-debug --enable-maintainer-zts --enable-pthreads --prefix=/usr --with-config-file-path=/etc --enable-fpm --with-mysql --with-mysql-sock=/var/lib/mysql/mysql.sock --with-pdo-mysql --with-gd --with-libxml-dir=/usr/local/libxml2 --with-png-dir=/usr/local/libpng --with-jpeg-dir=/usr/local/jpeg9 --with-vpx-dir=/usr/local/vpx --with-mcrypt=/usr/local/libmcrypt --with-mysqli --with-freetype-dir=/usr/local/freetype --with-iconv --with-zlib --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --enable-mbregex --enable-mbstring --enable-ftp --enable-gd-native-ttf --with-openssl --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --enable-session --with-curl --enable-ctype
5.安装
# make
# make install
6.配置php-fpm配置为服务
# cp /root/php-5.4.36/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
# cp /usr/etc/php-fpm.conf.default /usr/etc/php-fpm.conf
# chmod 755 /etc/init.d/php-fpm
# chkconfig –add php-fpm
最后,php-fpm以服务的方式启动、停止和重启:
# service php-fpm start
# service php-fpm stop
# service php-fpm reload
至此php+pthreads安装成功
第4步遇见的错误
1.configure: error: no acceptable C compiler found in $PATH
解决方式
#yum install gcc-c++
2.configure: error: xml2-config not found. Please check your libxml2 installation.
解决方式
# yum install libxml2
# yum install libxml2-devel -y
3.configure: error: jpeglib.h not found.
解决方式
# yum -y install libjpeg-devel
4. configure: error: vpx_codec.h not found.
解决方式
# yum -y install libvpx-devel
5.configure: error: png.h not found.
解决方式
# yum -y install libpng-devel
6.configure: Cannot find OpenSSL‘s <evp.h>
解决方式
# yum install openssl openssl-devel
7.configure:Please reinstall the libcurl distribution -
easy.h should be in <curl-dir>/include/curl/
解决方式
# yum -y install curl-devel
8.configure:freetype.h not found.
解决方式
# yum install freetype-devel
9.configure: error: mcrypt.h not found. Please reinstall libmcrypt.
解决方式:
# yum install libmcrypt libmcrypt-devel
参考文章:
http://php.net/manual/en/pthreads.installation.php
https://blog.csdn.net/zyz511919766/article/details/14002497/
https://blog.csdn.net/dabao1989/article/details/22898857
https://www.cnblogs.com/beyang/p/6972412.html
https://blog.csdn.net/qq_36180117/article/details/80813093
原文地址:https://www.cnblogs.com/liyang6/p/11641927.html