如何我要安装php7自定义选项该如何修改?如打开pthreads

问答中心分类: PHP如何我要安装php7自定义选项该如何修改?如打开pthreads
匿名用户 asked 9 年 ago

如何我要安装php7自定义选项该如何修改?如打开pthreads

6 Answers
oneinstack answered 9 年 ago
需要重启编译php7 加上参数--enable-maintainer-zts 启用线程安全 ,或者安装php7编辑 include/php-7.sh 加上参数,再下载模块

wget https://github.com/krakjoe/pthreads/archive/v3.1.5.tar.gz
tar xzvf v3.1.5.tar.gz
cd pthreads-3.1.5
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make && make install

编译出pthreads.so,在/usr/local/php/etc/php.ini ,加载这个模块,重启php

匿名用户 answered 9 年 ago
[root@bogon]/home/heixiake/soft/oneinstack/src/php-7.0.0/ext/pthreads-3.1.5# ./configure --with-php-config=/usr/local/php/bin/php-config
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for PHP prefix... /usr/local/php
checking for PHP includes... -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib
checking for PHP extension directory... /usr/local/php/lib/php/extensions/no-debug-non-zts-20151012
checking for PHP installed headers prefix... /usr/local/php/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... gawk
checking whether to enable pthreads... yes, shared
checking wether to enable AddressSanitizer for pthreads... no
checking wether to enable dmalloc for pthreads... no
checking for ZTS... configure: error: pthreads requires ZTS, please re-compile PHP with ZTS enabled
[root@bogon]/home/heixiake/soft/oneinstack/src/php-7.0.0/ext/pthreads-3.1.5#

oneinstack answered 9 年 ago
php7 加上参数–enable-maintainer-zts 启用线程安全
相同问题不要重复提交问题哦,谢谢啦

匿名用户 answered 9 年 ago
不好意思,我还以为这个跟贴你收不到,启用就是直接改include/php-7.sh这个文件吧,把以前的php删除,重新安装是吧?

oneinstack answered 9 年 ago
恩 重新编译试试

oneinstack answered 6 年 ago
1. 安装前修改options.conf新增--enable-maintainer-zts参数

php_modules_options='--enable-maintainer-zts'

2. 安装php
3. 安装pthread

cd ~/oneinstack/src
wget http://pecl.php.net/get/pthreads-3.1.6.tgz
tar xzf pthreads-3.1.6.tgz
cd pthreads-3.1.6
/usr/local/php/bin/phpize 
./configure --with-php-config=/usr/local/php/bin/php-config
make && make install
ls  #查看有没有 pthreads.so,如果有,证明编译成功
#加载pthreads
echo extension=pthreads.so > /usr/local/php/etc/php.d/ext-pthreads.ini

4. 重载php-fpm

service php-fpm reload