PHP线程编译不起作用 [英] PHP Thread compilation not working

查看:23
本文介绍了PHP线程编译不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am attempting to use pthreads with Apache FPM.

第一步.

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

After installing and recompiling php according to:

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

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

The server works as expected and I can run pthreads from CLI.

第 2 步.

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

Then I need to run threads from a web server so I followed the instructions from:

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

sudo service apache2 重启后&&须藤服务 php7.0-fpm 重启:

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 软件包的新手.

Needless to say I am a newbie when it comes to compiling Linux packages.

有什么建议吗?

推荐答案

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

I am attempting to use pthreads with Apache FPM.

你不能.找到一种没有他们的工作方式.

You can't. Find a way to work without them.

不能在 web 服务器环境中使用 pthreads 扩展.因此,PHP 中的线程仅限于基于 CLI 的应用程序.

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线程编译不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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