PHP线程编译不工作

标签 php linux pthreads apache2 fpm

我正在尝试将 pthreads 与 Apache FPM 结合使用。

第一步。

安装并重新编译php后根据:

https://blog.programster.org/ubuntu16-04-compile-php-7-2-with-pthreads

服务器按预期工作,我可以从 CLI 运行 pthreads。

第 2 步。

然后我需要从网络服务器运行线程,所以我按照以下说明进行操作:

https://antrecu.com/blog/run-php7-fpm-apache-mpmevent-ubuntu-1604

sudo service apache2 restart && sudo service php7.0-fpm restart之后:

Job for apache2.service failed because the control process exited with error code. 
See "systemctl status apache2.service" and "journalctl -xe" for details.

$ systemctl status apache2.service

apache2.service - LSB: Apache2 web server

   Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)

  Drop-In: /lib/systemd/system/apache2.service.d

           └─apache2-systemd.conf
   Active: failed (Result: exit-code) since Mon 2018-03-12 17:09:45 PDT; 3min 35s ago

     Docs: man:systemd-sysv-generator(8)


  Process: 30818 ExecStop=/etc/init.d/apache2 stop (code=exited, status=0/SUCCESS)

  Process: 32443 ExecStart=/etc/init.d/apache2 start (code=exited, status=1/FAILURE)


Mar 12 17:09:45 ubuntu apache2[32443]:  * The apache2 configtest failed.

Mar 12 17:09:45 ubuntu apache2[32443]: Output of config test was:

Mar 12 17:09:45 ubuntu apache2[32443]: [Mon Mar 12 17:09:45.084452 2018] [:crit] [pid 32454:tid 139629110323072] 

Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe.  You n.. (output cut off in SSH client)

Mar 12 17:09:45 ubuntu apache2[32443]: AH00013: Pre-configuration failed

Mar 12 17:09:45 ubuntu apache2[32443]: Action 'configtest' failed.

Mar 12 17:09:45 ubuntu apache2[32443]: The Apache error log may have more information.

Mar 12 17:09:45 ubuntu systemd[1]: apache2.service: Control process exited, code=exited status=1

Mar 12 17:09:45 ubuntu systemd[1]: Failed to start LSB: Apache2 web server.

Mar 12 17:09:45 ubuntu systemd[1]: apache2.service: Unit entered failed state.

不用说,在编译 Linux 软件包方面我是个新手。

有什么建议吗?

最佳答案

I am attempting to use pthreads with Apache FPM.

你不能。想办法在没有他们的情况下工作。

The pthreads extension cannot be used in a web server environment. Threading in PHP is therefore restricted to CLI-based applications only.

-- http://php.net/manual/en/intro.pthreads.php

关于PHP线程编译不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49246475/

相关文章:

javascript - 大图片无法上传Ajax/Jquery,FormData为空

php - Varnish -在轮询 Controller 中提供cookie/ session 时缓存

PHP preg_match() 返回最后一次匹配的位置

linux - 导出 : Command not found raised by linux source command

c - 如何使用多个写入器和多个读取器来实现 Readers Writers

c++ - TBB 并发无序映射导致段错误

javascript - 如何在 PHP 中执行正确的无符号右移?

linux - 期望不按预期工作

c++ - 写入文件时,fprintf 与 printf 不同吗?

android - Linux 2.6内核进程管理