php-pm / drupal-adapter
Requires
This package is auto-updated.
Last update: 2024-09-11 00:15:29 UTC
README
概述
这是PHP-PM的HttpKernel适配器的分支,用于集成Drupal与PHP-PM(因此也支持ReactPHP)。
主要组件是一个引导程序和桥接器。
参考
- https://github.com/php-pm/php-pm
- https://github.com/php-pm/php-pm-httpkernel
- http://marcjschmidt.de/blog/2014/02/08/php-high-performance.html
代码处于alpha版本 -- 非常实验性。最后测试针对 drupal-8.0.2
。
在 https://github.com/php-pm/php-pm-drupal/issues 查看或报告问题。
设置/使用
-
安装Drupal。
-
从Drupal网站根目录,使用composer安装此项目:
composer require php-pm/drupal-adapter
。
这将也会安装PHP-PM和默认的React <-> Symfony桥接器(php-pm/httpkernel-adapter)。
-
将这些补丁应用到Drupal核心:*
vendor/kentr/php-pm-drupal-adapter/patches/kentr-allow-repeated-setSitePath-in-DrupalKernel.patch
*vendor/kentr/php-pm-drupal-adapter/patches/stop_using-2505339-24.patch
-
使用以下命令启动php-pm
<absolute path to web root>/vendor/bin/ppm \ start \ <absolute path to web root> \ --bridge=httpKernel \ --bootstrap=PHPPM\\Bootstraps\\Drupal
示例
/var/www/html/vendor/bin/ppm \ start \ /var/www/html/ \ --bridge=httpKernel \ --bootstrap=PHPPM\\Bootstraps\\Drupal
DrupalKernel桥接器
默认情况下,PHP-PM使用\PHPPM\Bridges\HttpKernel
桥接器将ReactPHP请求转换为Symfony请求,并将Symfony响应转换为ReactPHP响应。
包含的\PHPPM\Bridges\DrupalKernel
桥接器扩展了\PHPPM\Bridges\HttpKernel
,以填充由CGI/1.1 (RFC 3875)指定的各种请求元变量。
设置/使用
-
按上述说明安装。
-
在php-pm启动命令中包含环境变量和
--bridge
选项。
Supported environment variables:
* **SCRIPT_NAME:** '/index.php' to emulate a standard setup where web requests execute Drupal's `index.php` script.
* **SERVER_NAME:** Your site's server / domain name. If you're using trusted host settings (`$settings['trusted_host_patterns']` in `settings.php`), this must match one of the trusted hosts.
* **SERVER_ADDRESS:** IP address of the server.
* **DOCUMENT_ROOT:** Absolute filepath of the web root directory.
示例
SCRIPT_NAME=/index.php \ SERVER_NAME=localhost \ SERVER_ADDRESS=127.0.0.1 \ DOCUMENT_ROOT=/var/www/html \ /var/www/html/vendor/bin/ppm start /var/www/html \ --bridge=PHPPM\\Bridges\\DrupalKernel \ --bootstrap=PHPPM\\Bootstraps\\Drupal