2017-07-07 64 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