From ad2c698098027378ee5d470ff64c1dc9b8e32de6 Mon Sep 17 00:00:00 2001 From: Denis Alustau Date: Mon, 13 Nov 2023 16:45:07 +0100 Subject: [PATCH] Add slash in the end of laravel home path when use realpath --- src/LaravelRootResolver.php | 24 ++++++++++++++++++++++++ src/bref-init.php | 20 ++++---------------- 2 files changed, 28 insertions(+), 16 deletions(-) create mode 100644 src/LaravelRootResolver.php diff --git a/src/LaravelRootResolver.php b/src/LaravelRootResolver.php new file mode 100644 index 0000000..98abcbb --- /dev/null +++ b/src/LaravelRootResolver.php @@ -0,0 +1,24 @@ +&2 redirects the output to STDERR to avoid messing up HTTP responses with FPM - passthru("php {$laravelHome}artisan config:cache 1>&2"); + passthru("php {$laravelRoot}artisan config:cache 1>&2"); } }); Bref::setContainer(static fn() => new HandlerResolver); - -function resolveBootstrapLocation(): string -{ - $laravelHome = $_SERVER['LAMBDA_TASK_ROOT'] . '/bootstrap/cache/config.php'; - - if (file_exists($laravelHome)) { - return $_SERVER['LAMBDA_TASK_ROOT']; - } - - // Going up 4 directories will get us from `vendor/brefphp/laravel-bridge/src` to the Laravel root folder - return realpath(__DIR__ . '/../../../../'); -}