【问题标题】:PHP Fatal error: Class 'Threaded' not found in /var/www/ ... .php on line nnPHP 致命错误:在第 nn 行的 /var/www/ ... .php 中找不到类 'Threaded'
【发布时间】:2017-04-24 08:04:15
【问题描述】:

我已经在 Centos 7 上使用 Remi 存储库安装了 php70,并且需要启用线程安全,因为我收到了标题中提到的错误。

运行:

php70 -i|grep -i thread

我明白了:

Thread Safety => disabled

我已尝试通过 yum 安装 php-pecl-pthreads 软件包,但错误仍然存​​在。

进一步调查(根据这个问题here),似乎线程安全是 php 版本的编译方式,而不仅仅是 php 扩展。

我应该使用不同的 repo 来让 php 7.0 具有线程安全性吗?如果是这样,哪个回购最好?它甚至存在于 repo 中还是我应该从源代码编译具有线程安全性的 php 70?

谢谢,

【问题讨论】:

    标签: php multithreading centos yum


    【解决方案1】:

    从命令行,您需要使用 zts-php 命令。

    # zts-php -i|grep -i thread
    Thread Safety => enabled
    

    注意事项:

    • zts-php 命令仅在 remi-php70 存储库的 php-cli 包中可用(不在 php70-php-cli SCL 包中)
    • Threaded 类命令由 pthreads 扩展(需要 ZTS 构建)提供,并且仅适用于 CLI。

    【讨论】:

    • 嗨 Remi,我无法执行该命令,并且执行 'yum search zts' 只会返回 php-pecl-pthreads 包。我使用的仓库是rpms.famillecollet.com/enterprise/remi-release-7.rpm Cheers。
    • 你是如何安装 PHP 7 的? “remi-php70”存储库中的“php-cli”包提供了此命令(php70-php-cli,没有),请参阅向导:rpms.remirepo.net/wizard
    • 太棒了,谢谢雷米!向导使它变得更容易了。谢谢!
    猜你喜欢
    • 1970-01-01
    • 2012-08-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-08-19
    • 1970-01-01
    相关资源
    最近更新 更多