From 521438c2fbbaaf4b6a04eba7caf6c8436b47faae Mon Sep 17 00:00:00 2001 From: Till Backhaus Date: Fri, 15 Jun 2018 10:09:50 +0200 Subject: [PATCH] Throw an exception if apc middleware is registered but apc is not enabled on cli. --- src/LumenServiceProvider.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/LumenServiceProvider.php b/src/LumenServiceProvider.php index a115ca5..8381709 100644 --- a/src/LumenServiceProvider.php +++ b/src/LumenServiceProvider.php @@ -40,6 +40,12 @@ public function register() switch (config('prometheus_exporter.adapter')) { case 'apc': + if ('cli' == php_sapi_name()) { + if (!ini_get('apc.enable_cli') || !extension_loaded('apc')) { + throw new \ErrorException( + 'Registered apc adapter, but apc is disabled. Set apc.enable_cli=1 to fix this'); + } + } $this->app->bind('Prometheus\Storage\Adapter', 'Prometheus\Storage\APC'); break; case 'redis':