Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/multithreading/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
为PHP7.1启用线程安全_Php_Multithreading_Compilation_Pthreads - Fatal编程技术网

为PHP7.1启用线程安全

为PHP7.1启用线程安全,php,multithreading,compilation,pthreads,Php,Multithreading,Compilation,Pthreads,我克隆了php 7.1: apshenichnikov@IAS-WS-UX02:~/php-src$ git status On branch PHP-7.1 I make./buildconf--force 我运行: 我已成功运行make&make安装: apshenichnikov@IAS-WS-UX02:~/php-src$ sudo make install Installing shared extensions: /usr/local/php/lib/php/extensi

我克隆了php 7.1:

apshenichnikov@IAS-WS-UX02:~/php-src$ git status
On branch PHP-7.1
I make./buildconf--force
我运行:

我已成功运行make&make安装:

apshenichnikov@IAS-WS-UX02:~/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安装pthreads时,我得到:

apshenichnikov@IAS-WS-UX02:~/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。
我使用不同的分支重新编译了PHP,并进行了清理。

结果总是一样的。

虽然您构建了一个新的PHP副本,但在构建pthreads扩展时没有使用它。您可以在
/configure
命令的输出中看到这一点,其中包含的文件指向您的(可能是旧的)PHP安装:

检查PHP包括-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

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

查看这里,希望对您有所帮助
apshenichnikov@IAS-WS-UX02:~/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