PHP CLI工作但CGI没有编译后(Ubuntu)

时间:2015-12-26 08:56:36

标签: ubuntu pthreads php-extension

我想在PHP 7.0.3扩展程序中安装Pthreads。 (以及另外2个自定义附加信息protobuf& curve25519)。

我已经完成了以下步骤。

// Download PHP
cd /usr/local/src
sudo git clone https://github.com/php/php-src.git

// copy pthreads in Php extensions file
sudo cp -r pthreads-3.1.5 php-src/ext/
cd /usr/local/src/php-src

sudo ./configure --prefix=/usr --with-config-file-path=/etc --enable-maintainer-zts
sudo make 
sudo make install
sudo make test

cp php.ini-development /etc/php.ini 

sudo pecl install pthreads    
// Edit /etc/php.ini File
// extension=pthreads.so

但问题是它在命令行中工作正常但在浏览器中没有工作(在localhost中)。

我从http://php.net/manual/en/pthreads.installation.php#114837

获取了参考文献

注意:我需要在php安装中启用Thread Safety

1 个答案:

答案 0 :(得分:0)

看起来应该更像这样:

#!/bin/bash
sudo su - root

cd /usr/local/src

git clone https://github.com/php/php-src.git php-src
git clone https://github.com/krakjoe/pthreads php-src/ext/pthreads

cd php-src
./buildconf --force
./configure --prefix=/usr --with-config-file-path=/etc --enable-maintainer-zts --enable-pthreads=shared

make
make test
make install

cp php.ini-development /etc/php.ini
cp php.ini-development /etc/php-cli.ini

echo "extension=pthreads.so" > /etc/php-cli.ini

/usr/bin/php -v
/usr/bin/php -m

您只能在CLI中加载pthread。