Php Apache2,pthreads。致命错误。pthreads不支持apache2handler SAPI
我的ubuntu上有apache2 web服务器。我需要安装pthreads,所以我从rep(copy to/ext/)克隆了php7和pthreads的源代码。 我安装了php的所有库,然后运行Php Apache2,pthreads。致命错误。pthreads不支持apache2handler SAPI,php,ubuntu,pthreads,apache2,php-7,Php,Ubuntu,Pthreads,Apache2,Php 7,我的ubuntu上有apache2 web服务器。我需要安装pthreads,所以我从rep(copy to/ext/)克隆了php7和pthreads的源代码。 我安装了php的所有库,然后运行 ./buildconf 及 ./configure--prefix=/usr--with config file path=/etc--enable bcmath--enable calendar--enable cli--enable debug--enable dba--enable exif
./buildconf
及
./configure--prefix=/usr--with config file path=/etc--enable bcmath--enable calendar--enable cli--enable debug--enable dba--enable exif--enable ftp--enable gd native ttf--enable mbregex--enable mbstring--enable pcntl--enable shmop--enable soap--enable opcache--enable sockets--enable sysvmsg enable sysvsem--ena--启用wddx——启用zip——启用维护者zts——使用freetype dir=/usr/local/opt/freetype——使用openssl——使用gd——使用gettext=/usr/local/opt/gettext——使用iconv dir=/usr——使用icu dir=/usr——使用mhash——使用jpeg dir=/usr/local/opt/jpeg——使用kerberos=/usr——使用libedit——使用mhash--使用png dir=/usr/local/opt/libpng--with-zlib=/usr--with-apxs2=/usr/bin/apxs--libexecdir=/usr/local/php7/7.0.0/libexec--with-bz2=/usr--enable fpm--with-fpm-user=\u-www--with-curl--with-mysqli=mysqlnd--with-pdo-mysql=mysqlnd--with-with-mcrypt--enable pthreads
它完成得很好,我执行了“make”和“makeinstall”。
然后,我在控制台中执行了以下命令:
sudo a2dismod php5
sudo cp /etc/apache2/mods-available/php5.conf /etc/apache2/mods-enabled/php7.conf
sudo rm -rf /usr/bin/php && sudo ln -s /etc /usr/bin/php
sudo service apache2 restart
通过这种方式,我得到了带有php7的apache2,但它没有启动并为我提供日志:
PHP致命错误:pthreads不支持apache2handler SAPI
在第0行的未知PHP中出现致命错误:无法启动pthreads模块
第0行未知(0)中的未知:致命错误-apache2handler
pthreads Unknown(0)不支持SAPI:致命错误-无法
启动pthreads模块
如果我在配置php7时没有--enable pthreads,它就可以工作。我执行了phpinfo()并得到了结果
如何解决此问题?pthreads v3禁止加载CLI以外的任何内容 在web服务器上下文中创建线程以响应客户机从来没有意义。在服务器创建的线程之外创建线程会破坏稳定性和可伸缩性 在其他多线程、多进程应用程序的内部创建多线程应用程序,而没有任何适当的方法使其中一个应用程序正确地感知并为另一个应用程序做好准备,这是一个糟糕的想法;它无法可靠工作,因此被禁用 您必须为命令行保留多线程,因为它是安全和合理的
构建pthreads shared(-enable pthreads=shared)并仅在CLI中加载它将解决您的问题。非常感谢!这非常有帮助。您认为“…并且只在CLI中加载”是什么意思?如何在CLI中加载它?当我运行php-m时,我没有看到pthreads模块被加载。我错过了什么?好啊我找到了答案:哇,我花了大约一天的时间研究如何使用pthreads手动构建php7,并在apache中启用它,最后才发现这一点