From 035bbfdebba8d903159e7d81acd38c7bcb9ad55c Mon Sep 17 00:00:00 2001 From: KentR Date: Fri, 10 Mar 2017 11:35:50 -0800 Subject: [PATCH 1/3] Create start-ppm-php-fpm.php --- web/start-ppm-php-fpm.php | 79 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 web/start-ppm-php-fpm.php diff --git a/web/start-ppm-php-fpm.php b/web/start-ppm-php-fpm.php new file mode 100644 index 0000000..1649e24 --- /dev/null +++ b/web/start-ppm-php-fpm.php @@ -0,0 +1,79 @@ +getEnvironment(); + } +} + +use Symfony\Component\Console\Application; +use Symfony\Component\Console\Output\StreamOutput; +use PHPPM\Commands\StartCommand; +use PHPPM\Commands\StatusCommand; +use Symfony\Component\Console\Input\ArgvInput; +use Symfony\Component\Debug\Debug; +use Symfony\Component\Debug\ErrorHandler; +use Symfony\Component\Debug\BufferingLogger; + +// Debug::enable(); +// ErrorHandler::stackErrors(); +// ErrorHandler::register(new ErrorHandler(new BufferingLogger())); + +$input = new ArgvInput(['vendor/bin/ppm', 'start', '/var/www/html']); + +$app = new Application('PHP-PM'); +$app->add(new StartCommand); +$app->add(new StatusCommand); + +// This setup with php-fcgi SAPI doesn't support php://stderr or php://stdout. +$output = new StreamOutput(fopen('php://output', 'w')); + +$app->run($input, $output); From bed776a43b58f563215e2a817e1b2b312926d9bd Mon Sep 17 00:00:00 2001 From: KentR Date: Fri, 10 Mar 2017 11:59:44 -0800 Subject: [PATCH 2/3] added php-fpm documentation --- README.md | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9af34c2..1189b4b 100644 --- a/README.md +++ b/README.md @@ -67,10 +67,31 @@ Example: ```bash SCRIPT_NAME=/index.php \ +REQUEST_METHOD=GET \ SERVER_NAME=localhost \ SERVER_ADDRESS=127.0.0.1 \ DOCUMENT_ROOT=/var/www/html \ -/var/www/html/vendor/bin/ppm start /var/www/html \ +vendor/bin/ppm start /var/www/html \ --bridge=PHPPM\\Bridges\\DrupalKernel \ --bootstrap=PHPPM\\Bootstraps\\Drupal ``` + +## Starting under PHP-FPM + +General idea is to use `[cgi-fcgi](https://docs.oracle.com/cd/E53394_01/html/E54763/cgi-fcgi-1.html)` as a bridge. + +Draft outline (needs work): + +* Put `start-ppm-php-fpm.php` in your webroot. +* Install and configure `PHP-FPM` to listen on port `9000` +* Execute as `root`: + +``` +SCRIPT_FILENAME=/var/www/html/start-ppm-php-fpm.php \ +SCRIPT_NAME=/index.php \ +REQUEST_METHOD=GET \ +SERVER_NAME=localhost \ +SERVER_ADDRESS=127.0.0.1 \ +DOCUMENT_ROOT=/var/www/html \ +cgi-fcgi -bind -connect 127.0.0.1:9000 +``` From f3afa42d63c683c71adb03b7f2cb772b0de5cf84 Mon Sep 17 00:00:00 2001 From: KentR Date: Fri, 10 Mar 2017 12:04:30 -0800 Subject: [PATCH 3/3] add "install cgi-fcgi" to PHP-FPM instructions --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 1189b4b..5c99d43 100644 --- a/README.md +++ b/README.md @@ -82,6 +82,7 @@ General idea is to use `[cgi-fcgi](https://docs.oracle.com/cd/E53394_01/html/E54 Draft outline (needs work): +* Install `cgi-fcgi` on your system. * Put `start-ppm-php-fpm.php` in your webroot. * Install and configure `PHP-FPM` to listen on port `9000` * Execute as `root`: