2017-07-07 78 views
0

线程安全我克隆PHP 7.1:启用PHP 7.1

[email protected]:~/php-src$ git status 
On branch PHP-7.1 

我做./buildconf即可--force
我运行:

./configure \ 
    --enable-hash \ 
    --prefix=/usr/local/php \ 
    --enable-maintainer-zts \ 
    --with-tsrm-pthreads \ 
    --with-pdo-oci=shared,instantclient,/opt/oracle/instantclient,12.1 

我成功运行做出&使安装:

[email protected]:~/php-src$ sudo make install 
Installing shared extensions:  /usr/local/php/lib/php/extensions/no-debug-zts-20151012/ 
Installing PHP CLI binary:  /usr/local/php/bin/ 
Installing PHP CLI man page:  /usr/local/php/php/man/man1/ 
Installing phpdbg binary:   /usr/local/php/bin/ 
Installing phpdbg man page:  /usr/local/php/php/man/man1/ 
Installing PHP CGI binary:  /usr/local/php/bin/ 
Installing PHP CGI man page:  /usr/local/php/php/man/man1/ 
Installing build environment:  /usr/local/php/lib/php/build/ 
Installing header files:   /usr/local/php/include/php/ 
Installing helper programs:  /usr/local/php/bin/ 
    program: phpize 
    program: php-config 
Installing man pages:    /usr/local/php/php/man/man1/ 
    page: phpize.1 
    page: php-config.1 
Installing PEAR environment:  /usr/local/php/lib/php/ 
[PEAR] Archive_Tar - already installed: 1.4.0 
[PEAR] Console_Getopt - already installed: 1.4.1 
[PEAR] Structures_Graph- already installed: 1.1.1 
[PEAR] XML_Util  - already installed: 1.3.0 
[PEAR] PEAR   - already installed: 1.10.1 
Warning! a PEAR user config file already exists from a previous PEAR installation at '/home/apshenichnikov/.pearrc'. You may probably want to remove it. 
Wrote PEAR system config file at: /usr/local/php/etc/pear.conf 
You may want to add: /usr/local/php/lib/php to your php.ini include_path 
/home/apshenichnikov/php-src/build/shtool install -c ext/phar/phar.phar /usr/local/php/bin 
ln -s -f phar.phar /usr/local/php/bin/phar 
Installing PDO headers:   /usr/local/php/include/php/ext/pdo/ 

当我运行phpinfo时,得到:“线程安全禁用”
当我尝试安装通过PECL并行线程我得到:

[email protected]:~/php-src$ sudo pecl install pthreads 
downloading pthreads-3.1.6.tgz ... 
Starting to download pthreads-3.1.6.tgz (80,932 bytes) 
...................done: 80,932 bytes 
28 source files, building 
running: phpize 
Configuring for: 
PHP Api Version:   20151012 
Zend Module Api No:  20151012 
Zend Extension Api No: 320151012 
building in /tmp/pear/temp/pear-build-rootkhkb7n/pthreads-3.1.6 
running: /tmp/pear/temp/pthreads/configure --with-php-config=/usr/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 whether the C compiler works... yes 
checking for C compiler default output file name... a.out 
checking for suffix of executables... 
checking whether we are cross compiling... no 
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-pc-linux-gnu 
checking host system type... x86_64-pc-linux-gnu 
checking target system type... x86_64-pc-linux-gnu 
checking for PHP prefix... /usr 
checking for PHP includes... -I/usr/include/php/20151012 -I/usr/include/php/20151012/main -I/usr/include/php/20151012/TSRM -I/usr/include/php/20151012/Zend -I/usr/include/php/20151012/ext -I/usr/include/php/20151012/ext/date/lib 
checking for PHP extension directory... /usr/lib/php/20151012 
checking for PHP installed headers prefix... /usr/include/php/20151012 
checking if debug is enabled... no 
checking if zts is enabled... no 
checking for re2c... re2c 
checking for re2c version... 0.16 (ok) 
checking for gawk... gawk 
checking whether to enable pthreads... yes, shared 
checking whether to enable AddressSanitizer for pthreads... no 
checking whether to enable dmalloc for pthreads... no 
checking for ZTS... configure: error: pthreads requires ZTS, please re-compile PHP with ZTS enabled 
ERROR: `/tmp/pear/temp/pthreads/configure --with-php-config=/usr/bin/php-config' failed 

我确信那PECL和使用的Apache2最近的PHP编译。
我使用differend分支重新编译PHP并使其干净。
它总是一样的结果。

+0

看这里,希望它帮助https://stackoverflow.com/a/44758476/6224176 – buildok

回答

0

虽然您已经构建了PHP的新副本,但在构建pthreads扩展时并未使用它。

检查PHP包括... -I/usr/include目录/ PHP/20151012:您可以输出从./configure命令,其中包括文件都指向您的(可能是旧的)PHP安装看到这-I/usr/include/php/20151012/main -I/usr/include/php/20151012/TSRM -I/usr/include/php/20151012/Zend -I/usr/include/php/20151012/ext -I/usr/include目录/ PHP/20151012 /转/日期/ lib目录

您可以通过指定的配置二进制是使用--with-php-config设置你的PHP的新鲜构建解决这个问题。根据您的安装,它应该位于/usr/local/php/bin/php-config