我需要在 apache2 中将 PHP-FPM 与 pthread 一起使用,以提高在 Ubuntu 16.04 中运行的 Prestashop 1.6 商店的性能。
我做了很多意图。这是最后两个测试:
1) 我能够在 XAMP v3.2.1 中使用 pthread 运行并行 PHP 代码,但它会重新启动 apache 服务器。我认为这与 XAMP 中 apache 已经使用工作线程的事实有关。(我在这里对此有疑问:https ://askubuntu.com/questions/1129449/is-apache2-using-threads-or-process-in-ubuntu-18-04 )
2)我按照本教程编译了 PHP 7.0.33:https ://blog.programster.org/install-php-7-0-with-pthreads-on-ubuntu-16.04我使用了一个基于 Ubuntu 的 docker 容器16.04,避免依赖问题和版本错误。但是,当我使用 pthread 代码访问 PHP 脚本时,我的浏览器中出现以下错误: 致命错误:第 5 行的 /var/www/html/test.php 中未找到 Class 'Threaded' 此脚本与教程中的那个,从 CLI 测试 pthread。
毕竟,我注意到 pthread 仅适用于 CLI。这在以下链接中进行了解释: https ://serverfault.com/questions/748001/the-apache2handler-sapi-is-not-supported-by-pthreads https://github.com/krakjoe/pthreads
所以我的问题是:
1) 有什么方法可以在 PHP-FPM 中使用 Pthread 和 apache 吗?
2) 有没有其他方法可以提高 PHP 的速度?(我已经尝试过:APC 和 APCU。)
预先感谢您的关注。