[英]Build PHP with pthreads using phpbrew
我想在包括pthreads的 Ubuntu 14上構建和使用自定義PHP 5.5.30。 但是我也想保留常規的PHP版本,並在需要時在版本之間來回切換。
我沒有時間,我不精通PHP的構建-我還沒有做過任何構建-因此我想要一個解決方案,以最簡單的方式抽象該過程。
要確保似乎使用phpbrew是正確的方法。
因此,我去下載了它,安裝了一些顯然是構建所需的新軟件包,最后我啟動了以下程序:
phpbrew install --name php-5.5.30-zts 5.5.30 +bcmath +cli +ctype +dom +fileinfo +filter +json +mbregex +mbstring +mhash +pcre +pdo +posix +sockets +tokenizer +curl +zts +intl +mysql +pgsql +session
phpbrew use php-5.5.29-zts
構建成功終止,並且CLI確實使用了新構建的php ...
之前:
me@ubuntu:/$ php -v
PHP 5.5.30-1+deb.sury.org~trusty+1 (cli) (built: Oct 4 2015 16:23:01)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies
me@ubuntu:/$ php -m
[PHP Modules]
bcmath
bz2
calendar
Core
ctype
curl
date
dba
dom
ereg
exif
fileinfo
filter
ftp
gd
gettext
hash
iconv
intl
json
ldap
libxml
mbstring
mcrypt
memcached
mhash
mysql
mysqli
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_pgsql
pdo_sqlite
pgsql
Phar
posix
readline
Reflection
session
shmop
SimpleXML
soap
sockets
SPL
sqlite3
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xml
xmlreader
xmlwriter
Zend OPcache
zip
zlib
[Zend Modules]
Zend OPcache
后:
me@ubuntu:/$ php -v
PHP 5.5.30 (cli) (built: Oct 6 2015 11:48:18)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies
me@ubuntu:/$ php -m
[PHP Modules]
bcmath
Core
ctype
date
dom
ereg
fileinfo
filter
hash
intl
json
libxml
mbstring
mhash
mysql
mysqli
mysqlnd
pcre
PDO
pdo_mysql
pdo_pgsql
pgsql
Phar
posix
Reflection
session
SimpleXML
sockets
SPL
standard
tokenizer
xml
xmlreader
xmlwriter
xsl
zlib
[Zend Modules]
但是,每個人都可以看到...生成的版本的可用模塊中都未列出任何zts模塊或pthreads。
所以...問題:
編輯:
我也嘗試了以下構建,但均無濟於事。 phpbrew拒絕在其內部版本中包含zts:
phpbrew install --name php-5.5.30-zts-only 5.5.30 -- --enable-maintainer-zts
phpbrew install --name php-5.5.30-zts-only 5.5.30 +zts -- --enable-maintainer-zts
phpbrew install --name php-5.5.30-zts-only 5.5.30 -- --enable-maintainer-zts --without-readline
為了簡單起見,所有這些都是最小的PHP,我想僅使用zts構建它們。 調用php -m
時,無最終生成zts模塊。
也許有某種先決條件? 可能要安裝一些軟件包?
編輯2:
我嘗試了以下方法:
phpbrew install 5.5.30 -- --enable-maintainer-zts
phpbrew use php-5.5.30
命令php -i | grep zts
php -i | grep zts
產生以下結果:
Configure Command => './configure' '--prefix=/home/linux1/.phpbrew/php/php-5.5.30' '--with-config-file-path=/home/linux1/.phpbrew/php/php-5.5.30/etc' '--with-config-file-scan-dir=/home/linux1/.phpbrew/php/php-5.5.30/var/db' '--with-pear=/home/linux1/.phpbrew/php/php-5.5.30/lib/php' '--disable-all' '--enable-session' '--enable-short-tags' '--with-zlib=/usr' '--with-libdir=lib/x86_64-linux-gnu' '--enable-bcmath' '--with-bz2=/usr' '--enable-calendar' '--enable-cli' '--enable-ctype' '--enable-fileinfo' '--enable-filter' '--enable-shmop' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg' '--enable-json' '--enable-mbregex' '--enable-mbstring' '--with-mhash=/usr' '--enable-pcntl' '--with-pcre-regex' '--with-pcre-dir=/usr' '--enable-pdo' '--enable-phar' '--enable-posix' '--with-readline=/usr' '--enable-sockets' '--enable-tokenizer' '--enable-dom' '--enable-libxml' '--enable-simplexml' '--enable-xml' '--enable-xmlreader' '--enable-xmlwriter' '--with-xsl' '--with-libxml-dir=/usr' '--enable-zip' '--with-openssl=yes' '--enable-maintainer-zts'
extension_dir => /home/linux1/.phpbrew/php/php-5.5.30/lib/php/extensions/no-debug-zts-20121212 => /home/linux1/.phpbrew/php/php-5.5.30/lib/php/extensions/no-debug-zts-20121212
不確定是否有幫助。
結論:
我忘記使用以下方法安裝pthreads擴展:
phpbrew ext install pthreads 2.0.10
請注意,您需要使用( phpbrew use php-my-build
)要在其上安裝擴展程序的php版本。
另外,請注意,只有在包含+openssl
作為變體的情況下,才能安裝pthreads
(否則,嘗試調用程序包遠程HTTPS URL將失敗)。
是的,phpbrew是一台PC上用於不同php版本的好主意,而無需擁有多個虛擬機。
首先,您應該指定這樣的選項---enable-maintainer-zts
腳步:
1. phpbrew install php-5.5.30 -- --enable-maintainer-zts
2. phpbrew use php-5.5.30
3. phpbrew ext install pthreads 2.0.10
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.