From a270cd9185e97b0516efd07ec604fc74e175843c Mon Sep 17 00:00:00 2001 From: Nyholm Date: Sun, 29 Jul 2018 22:02:27 -0700 Subject: [PATCH 1/6] Adding recipe for phpfastcgi/fastcgi-daemon --- .../1.0/config/packages/fastcgi-daemon.yaml | 9 +++++++ phpfastcgi/fastcgi-daemon/1.0/manifest.json | 6 +++++ .../fastcgi-daemon/1.0/post-install.txt | 10 +++++++ .../fastcgi-daemon/1.0/src/FastCGIKernel.php | 27 +++++++++++++++++++ 4 files changed, 52 insertions(+) create mode 100644 phpfastcgi/fastcgi-daemon/1.0/config/packages/fastcgi-daemon.yaml create mode 100644 phpfastcgi/fastcgi-daemon/1.0/manifest.json create mode 100644 phpfastcgi/fastcgi-daemon/1.0/post-install.txt create mode 100644 phpfastcgi/fastcgi-daemon/1.0/src/FastCGIKernel.php diff --git a/phpfastcgi/fastcgi-daemon/1.0/config/packages/fastcgi-daemon.yaml b/phpfastcgi/fastcgi-daemon/1.0/config/packages/fastcgi-daemon.yaml new file mode 100644 index 00000000..918f3e94 --- /dev/null +++ b/phpfastcgi/fastcgi-daemon/1.0/config/packages/fastcgi-daemon.yaml @@ -0,0 +1,9 @@ +services: + App\FastCGIKernel: + arguments: ['@App\Kernel'] + + PHPFastCGI\FastCGIDaemon\Driver\DriverContainer: ~ + PHPFastCGI\FastCGIDaemon\Command\DaemonRunCommand: + arguments: ['@App\FastCGIKernel', '@PHPFastCGI\FastCGIDaemon\Driver\DriverContainer', 'fastcgi-daemon:run'] + tags: + - { name: console.command } diff --git a/phpfastcgi/fastcgi-daemon/1.0/manifest.json b/phpfastcgi/fastcgi-daemon/1.0/manifest.json new file mode 100644 index 00000000..1727d5a0 --- /dev/null +++ b/phpfastcgi/fastcgi-daemon/1.0/manifest.json @@ -0,0 +1,6 @@ +{ + "copy-from-recipe": { + "config/": "%CONFIG_DIR%/", + "src/": "%SRC_DIR%/" + } +} diff --git a/phpfastcgi/fastcgi-daemon/1.0/post-install.txt b/phpfastcgi/fastcgi-daemon/1.0/post-install.txt new file mode 100644 index 00000000..ba23d456 --- /dev/null +++ b/phpfastcgi/fastcgi-daemon/1.0/post-install.txt @@ -0,0 +1,10 @@ + + What's next? + + + * Run your application: + 1. Configure your web server + 2. Execute the bin/console fastcgi-daemon:run command; + 3. Browse your application super quickly + + * Read the documentation at https://github.com/PHPFastCGI/FastCGIDaemon \ No newline at end of file diff --git a/phpfastcgi/fastcgi-daemon/1.0/src/FastCGIKernel.php b/phpfastcgi/fastcgi-daemon/1.0/src/FastCGIKernel.php new file mode 100644 index 00000000..632c65d8 --- /dev/null +++ b/phpfastcgi/fastcgi-daemon/1.0/src/FastCGIKernel.php @@ -0,0 +1,27 @@ +kernel = $kernel; + } + + public function handleRequest(RequestInterface $request) + { + $symfonyRequest = $request->getHttpFoundationRequest(); + + $symfonyResponse = $this->kernel->handle($symfonyRequest); + $this->kernel->terminate($symfonyRequest, $symfonyResponse); + + return $symfonyResponse; + } +} From 2b191f5904cfd78fb86ae1e04af096863b9f0773 Mon Sep 17 00:00:00 2001 From: Nyholm Date: Sun, 29 Jul 2018 22:04:21 -0700 Subject: [PATCH 2/6] Bugfixes --- .../packages/{fastcgi-daemon.yaml => fastcgi_daemon.yaml} | 0 phpfastcgi/fastcgi-daemon/1.0/post-install.txt | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename phpfastcgi/fastcgi-daemon/1.0/config/packages/{fastcgi-daemon.yaml => fastcgi_daemon.yaml} (100%) diff --git a/phpfastcgi/fastcgi-daemon/1.0/config/packages/fastcgi-daemon.yaml b/phpfastcgi/fastcgi-daemon/1.0/config/packages/fastcgi_daemon.yaml similarity index 100% rename from phpfastcgi/fastcgi-daemon/1.0/config/packages/fastcgi-daemon.yaml rename to phpfastcgi/fastcgi-daemon/1.0/config/packages/fastcgi_daemon.yaml diff --git a/phpfastcgi/fastcgi-daemon/1.0/post-install.txt b/phpfastcgi/fastcgi-daemon/1.0/post-install.txt index ba23d456..87cc0ac4 100644 --- a/phpfastcgi/fastcgi-daemon/1.0/post-install.txt +++ b/phpfastcgi/fastcgi-daemon/1.0/post-install.txt @@ -7,4 +7,4 @@ 2. Execute the bin/console fastcgi-daemon:run command; 3. Browse your application super quickly - * Read the documentation at https://github.com/PHPFastCGI/FastCGIDaemon \ No newline at end of file + * Read the documentation at https://github.com/PHPFastCGI/FastCGIDaemon From a36f59f50ed775530b06a5ca1e7da22b674f1f13 Mon Sep 17 00:00:00 2001 From: Nyholm Date: Mon, 30 Jul 2018 02:59:15 -0700 Subject: [PATCH 3/6] Verify that Kernel is terminatable. --- phpfastcgi/fastcgi-daemon/1.0/src/FastCGIKernel.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/phpfastcgi/fastcgi-daemon/1.0/src/FastCGIKernel.php b/phpfastcgi/fastcgi-daemon/1.0/src/FastCGIKernel.php index 632c65d8..9085941b 100644 --- a/phpfastcgi/fastcgi-daemon/1.0/src/FastCGIKernel.php +++ b/phpfastcgi/fastcgi-daemon/1.0/src/FastCGIKernel.php @@ -5,6 +5,7 @@ namespace App; use PHPFastCGI\FastCGIDaemon\Http\RequestInterface; use PHPFastCGI\FastCGIDaemon\KernelInterface; use Symfony\Component\HttpKernel\HttpKernelInterface; +use Symfony\Component\HttpKernel\TerminableInterface; class FastCGIKernel implements KernelInterface { @@ -18,9 +19,11 @@ class FastCGIKernel implements KernelInterface public function handleRequest(RequestInterface $request) { $symfonyRequest = $request->getHttpFoundationRequest(); - $symfonyResponse = $this->kernel->handle($symfonyRequest); - $this->kernel->terminate($symfonyRequest, $symfonyResponse); + + if ($this->kernel instanceof TerminableInterface) { + $this->kernel->terminate($symfonyRequest, $symfonyResponse); + } return $symfonyResponse; } From 2995c05970b3c8b68ad8adc5ce8748a255ac9ee3 Mon Sep 17 00:00:00 2001 From: Nyholm Date: Sun, 5 Aug 2018 16:02:28 +0200 Subject: [PATCH 4/6] Make sure we reset services between each request --- .../1.0/config/packages/fastcgi_daemon.yaml | 2 +- phpfastcgi/fastcgi-daemon/1.0/src/FastCGIKernel.php | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/phpfastcgi/fastcgi-daemon/1.0/config/packages/fastcgi_daemon.yaml b/phpfastcgi/fastcgi-daemon/1.0/config/packages/fastcgi_daemon.yaml index 918f3e94..fae353f3 100644 --- a/phpfastcgi/fastcgi-daemon/1.0/config/packages/fastcgi_daemon.yaml +++ b/phpfastcgi/fastcgi-daemon/1.0/config/packages/fastcgi_daemon.yaml @@ -1,6 +1,6 @@ services: App\FastCGIKernel: - arguments: ['@App\Kernel'] + autowire: true PHPFastCGI\FastCGIDaemon\Driver\DriverContainer: ~ PHPFastCGI\FastCGIDaemon\Command\DaemonRunCommand: diff --git a/phpfastcgi/fastcgi-daemon/1.0/src/FastCGIKernel.php b/phpfastcgi/fastcgi-daemon/1.0/src/FastCGIKernel.php index 9085941b..3aaab769 100644 --- a/phpfastcgi/fastcgi-daemon/1.0/src/FastCGIKernel.php +++ b/phpfastcgi/fastcgi-daemon/1.0/src/FastCGIKernel.php @@ -3,21 +3,23 @@ namespace App; use PHPFastCGI\FastCGIDaemon\Http\RequestInterface; -use PHPFastCGI\FastCGIDaemon\KernelInterface; -use Symfony\Component\HttpKernel\HttpKernelInterface; +use PHPFastCGI\FastCGIDaemon\KernelInterface as PHPFastCGIKernel; +use Symfony\Component\HttpKernel\KernelInterface; use Symfony\Component\HttpKernel\TerminableInterface; -class FastCGIKernel implements KernelInterface +class FastCGIKernel implements PHPFastCGIKernel { private $kernel; - public function __construct(HttpKernelInterface $kernel) + public function __construct(KernelInterface $kernel) { $this->kernel = $kernel; } public function handleRequest(RequestInterface $request) { + $this->kernel->boot(); // Or ->reboot() + $symfonyRequest = $request->getHttpFoundationRequest(); $symfonyResponse = $this->kernel->handle($symfonyRequest); @@ -28,3 +30,4 @@ class FastCGIKernel implements KernelInterface return $symfonyResponse; } } + From afe7b67df9e4022236eef4893bc080ea08743346 Mon Sep 17 00:00:00 2001 From: Nyholm Date: Sun, 5 Aug 2018 16:02:47 +0200 Subject: [PATCH 5/6] Updated version --- .../{1.0 => 0.11}/config/packages/fastcgi_daemon.yaml | 0 phpfastcgi/fastcgi-daemon/{1.0 => 0.11}/manifest.json | 0 phpfastcgi/fastcgi-daemon/{1.0 => 0.11}/post-install.txt | 0 phpfastcgi/fastcgi-daemon/{1.0 => 0.11}/src/FastCGIKernel.php | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename phpfastcgi/fastcgi-daemon/{1.0 => 0.11}/config/packages/fastcgi_daemon.yaml (100%) rename phpfastcgi/fastcgi-daemon/{1.0 => 0.11}/manifest.json (100%) rename phpfastcgi/fastcgi-daemon/{1.0 => 0.11}/post-install.txt (100%) rename phpfastcgi/fastcgi-daemon/{1.0 => 0.11}/src/FastCGIKernel.php (100%) diff --git a/phpfastcgi/fastcgi-daemon/1.0/config/packages/fastcgi_daemon.yaml b/phpfastcgi/fastcgi-daemon/0.11/config/packages/fastcgi_daemon.yaml similarity index 100% rename from phpfastcgi/fastcgi-daemon/1.0/config/packages/fastcgi_daemon.yaml rename to phpfastcgi/fastcgi-daemon/0.11/config/packages/fastcgi_daemon.yaml diff --git a/phpfastcgi/fastcgi-daemon/1.0/manifest.json b/phpfastcgi/fastcgi-daemon/0.11/manifest.json similarity index 100% rename from phpfastcgi/fastcgi-daemon/1.0/manifest.json rename to phpfastcgi/fastcgi-daemon/0.11/manifest.json diff --git a/phpfastcgi/fastcgi-daemon/1.0/post-install.txt b/phpfastcgi/fastcgi-daemon/0.11/post-install.txt similarity index 100% rename from phpfastcgi/fastcgi-daemon/1.0/post-install.txt rename to phpfastcgi/fastcgi-daemon/0.11/post-install.txt diff --git a/phpfastcgi/fastcgi-daemon/1.0/src/FastCGIKernel.php b/phpfastcgi/fastcgi-daemon/0.11/src/FastCGIKernel.php similarity index 100% rename from phpfastcgi/fastcgi-daemon/1.0/src/FastCGIKernel.php rename to phpfastcgi/fastcgi-daemon/0.11/src/FastCGIKernel.php From b50a47d874fbc025c849e9a2df9ff13a91e060df Mon Sep 17 00:00:00 2001 From: Tobias Nyholm Date: Wed, 22 Aug 2018 12:51:33 +0200 Subject: [PATCH 6/6] Removed comment about reboot --- phpfastcgi/fastcgi-daemon/0.11/src/FastCGIKernel.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpfastcgi/fastcgi-daemon/0.11/src/FastCGIKernel.php b/phpfastcgi/fastcgi-daemon/0.11/src/FastCGIKernel.php index 3aaab769..b26cf46c 100644 --- a/phpfastcgi/fastcgi-daemon/0.11/src/FastCGIKernel.php +++ b/phpfastcgi/fastcgi-daemon/0.11/src/FastCGIKernel.php @@ -18,7 +18,7 @@ class FastCGIKernel implements PHPFastCGIKernel public function handleRequest(RequestInterface $request) { - $this->kernel->boot(); // Or ->reboot() + $this->kernel->boot(); $symfonyRequest = $request->getHttpFoundationRequest(); $symfonyResponse = $this->kernel->handle($symfonyRequest);