动态配置PHP线程安全--enable-maintainer-zts,或使用yum安装pthreads? [英] Dynamically configure PHP for thread safety --enable-maintainer-zts, or use yum to install pthreads?

查看:7254
本文介绍了动态配置PHP线程安全--enable-maintainer-zts,或使用yum安装pthreads?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在PHP中启用线程安全而不重新编译,或使用YUM来执行此操作?

Is there a way to enable thread safety in PHP without recompiling, or to use YUM to do this?

我试图安装pthreads,已使用 - enable-maintainer-zts 编译。但是,我不与重新编译,因为我想使用yum管理我的PHP堆栈。我目前使用的REMI仓库。我注意到有一个包php-zts,但是,没有一个可用的我的PHP版本4.4,我找不到一个源RPM的php zts。

I am trying to install pthreads and it requires PHP to have been compiled with --enable-maintainer-zts. However, I do not with to recompile because I would like to manage my PHP stack using yum. I am currently using the REMI repo. I notice there is a package php-zts, however, there is not one available for my PHP version of 4.4 and I cannot find a source RPM for php-zts.

有一种方法,我可以使用yum和启用线程安全PHP,所以我可以使用

Is there a way I can use yum and enable thread safety in PHP, so I can install pThread by using

#pecl install channel://pecl.php.net/pthreads-0.0.42

downloading pthreads-0.0.42.tgz ...
Starting to download pthreads-0.0.42.tgz (53,755 bytes)
.............done: 53,755 bytes
33 source files, building
running: phpize
Configuring for:
PHP Api Version:         20100412
Zend Module Api No:      20100525
Zend Extension Api No:   220100525
building in /var/tmp/pear-build-rootkThpG6/pthreads-0.0.42
running: /var/tmp/pthreads/configure

...

checking whether to enable Threading API... yes, shared
checking checking for ZTS... configure: error: pthreads requires ZTS, please re-compile PHP with ZTS enabled
ERROR: `/var/tmp/pthreads/configure' failed

正如你可以看到它失败,因为PHP没有启用ZTS。 >

As you can see it fails, above, because PHP doesn't have ZTS enabled.

推荐答案

不幸的是,CLI的包维护者不能在大多数unix包中启用线程安全。它有时启用工作mpm apache,但不总是包括一个完整的构建环境(这样pecl将不工作)。

Unfortunately, package maintainers of CLI do not enable thread safety in most unix packages. It is sometimes enabled for worker mpm apache, but does not always include a full build environment ( such that pecl will not work ).

总之,没有办法在运行时启用ZTS,它是一个构建时间选项,在编译源之后不可能对构建进行更改。

In short, there is no way of enabling ZTS at runtime, it is a build time option that makes changes to the build simply not possible after compilation of the sources.

但是,安装不是很难

您的路径取决于您对发行版本的经验和您的预期用途。

The path you take depends much on your experience with your distro and your intended usage.

如果您希望使用线程安全版本覆盖系统安装,则有一些信息 http://pthreads.org/building

Should you wish to overwrite your system installation with a thread safe version, there's some info http://pthreads.org/building

如果你想构建一个独立的安装,一些信息可以在pthreads.org的建筑页面找到,此外,我一直在试验RPM, http://github.com/krakjoe/spex 包含一个rpmbuild文件,该文件将滚动一个master和主pthreads进入/ opt / php-pthreads与完整的构建环境,包括所有的钟声和口哨,在rpmbuild版本没有apache支持,因为它会使它更复杂和巨大,它包括fpm(也支持)。

Should you wish to build an isolated installation, some information can be found on the building page at pthreads.org, additionally, I have been experimenting with RPM's, http://github.com/krakjoe/spex contains an rpmbuild file that will roll a copy of master and master pthreads into /opt/php-pthreads with the complete build environment, includes and all the bells and whistles, no apache support in the rpmbuild version because it would make it more complex and huge, it does include fpm ( also supported ).

你是我遇到的第一个人,我可以建议使用rpmbuild,因为你可以保留其他VM的RPM,只有通过这一次(直到下一次更新),这个的缺点是,它使用PHP的出血边缘代码,这是目前在测试版...

You're the first person I have come across that I could actually advise to use the rpmbuild, on account of you can then keep the RPM for other VM's and only have to go through this once (until the next update anyway), the disadvantage of this is, it uses bleeding edge code from PHP, which is currently in beta...

希望让你去:)

这篇关于动态配置PHP线程安全--enable-maintainer-zts,或使用yum安装pthreads?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆