0、本文档是以workerman作为应用目标。默认目录为/tmp
1、编译安装php7.0.2
yum install openssl openssl-devel curl curl-devel gdbm-devel libjpeg-devel libpng-devel freetype-devel libmcrypt-devel libxml2-devel autoconf nano
wget http://au2.php.net/get/php-7.0.3.tar.gz/from/this/mirror -O php.tar.gz
tar -zxvf php.tar.gz
cd php-7.0.3
./configure --prefix=/usr/local/php7 --exec-prefix=/usr/local/php7 --bindir=/usr/local/php7/bin --sbindir=/usr/local/php7/sbin --includedir=/usr/local/php7/include --libdir=/usr/local/php7/lib/php --mandir=/usr/local/php7/php/man --with-config-file-path=/usr/local/php7/etc --with-mysql-sock=/var/lib/mysql/mysql.sock --with-mcrypt=/usr/include --with-mhash --with-mysqli=shared,mysqlnd --with-pdo-mysql=shared,mysqlnd --with-gd --with-iconv --with-zlib --enable-zip --enable-inline-optimization --disable-debug --disable-rpath --enable-shared --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-mbregex --enable-mbstring --enable-ftp --enable-pcntl --enable-sockets --with-xmlrpc --enable-soap --with-pear --with-gettext --enable-session --with-curl --with-openssl --with-jpeg-dir --with-freetype-dir --enable-opcache --enable-fpm --with-fpm-user=nginx --with-fpm-group=nginx --with-gdbm --enable-fileinfo --enable-maintainer-zts
make && make install
安装多线程库:
cd /usr/local/php7/bin
./pecl install pthreads
cd /tmp/php-7.0.3/
cp php.ini-production /usr/local/php7/etc/php.ini
cd /usr/local/php7/etc/
cp php.ini php-cli.ini
在末尾增加extension="pthreads.so"
找到date.timezone选项,删除前面的注释符,并将其值设置为 PRC
加入环境变量
nano /etc/profile
加入以下两行
PATH=$PATH:/usr/local/php7/bin:/usr/local/nginx/sbin
export PATH
执行命令source /etc/profile使修改生效
最后使用php -m检验安装情况,如果有pthreads模块就满足需求