diff --git a/bin/bootstrap.php b/bin/bootstrap.php index cbd66138d..58ddef357 100644 --- a/bin/bootstrap.php +++ b/bin/bootstrap.php @@ -15,7 +15,7 @@ | */ -$basePath = $_SERVER['APP_BASE_PATH'] ?? $_ENV['APP_BASE_PATH'] ?? $serverState['octaneConfig']['base_path'] ?? null; +$basePath = $_SERVER['APP_BASE_PATH'] ?? getenv('APP_BASE_PATH') ?? $serverState['octaneConfig']['base_path'] ?? null; if (! is_string($basePath)) { echo 'Cannot find application base path.'; @@ -35,7 +35,7 @@ | */ -$vendorDir = $_ENV['COMPOSER_VENDOR_DIR'] ?? "{$basePath}/vendor"; +$vendorDir = getenv('COMPOSER_VENDOR_DIR') ?? "{$basePath}/vendor"; if (! is_file($autoload_file = "{$vendorDir}/autoload.php")) { echo "Composer autoload file was not found. Did you install the project's dependencies?"; diff --git a/config/octane.php b/config/octane.php index 8cfba0114..03be7da58 100644 --- a/config/octane.php +++ b/config/octane.php @@ -221,4 +221,17 @@ 'max_execution_time' => 30, + /* + |-------------------------------------------------------------------------- + | Vendor Path + |-------------------------------------------------------------------------- + | + | This value determines the path to the "vendor" directory that Octane will + | use when bootstrapping the application. By default, it will use the + | vendor folder inside the base path of the application. + | + */ + + 'vendor_path' => env('OCTANE_VENDOR_PATH', base_path('vendor')), + ]; diff --git a/src/Commands/StartFrankenPhpCommand.php b/src/Commands/StartFrankenPhpCommand.php index 6f004b3f9..ddb9a5f6e 100644 --- a/src/Commands/StartFrankenPhpCommand.php +++ b/src/Commands/StartFrankenPhpCommand.php @@ -106,6 +106,7 @@ public function handle(ServerProcessInspector $inspector, ServerStateFile $serve 'CADDY_SERVER_WORKER_DIRECTIVE' => $this->workerCount() ? "num {$this->workerCount()}" : '', 'CADDY_SERVER_EXTRA_DIRECTIVES' => $this->buildMercureConfig(), 'CADDY_SERVER_WATCH_DIRECTIVES' => $this->buildWatchConfig(), + 'COMPOSER_VENDOR_DIR' => config('octane.vendor_path'), ])); $server = $process->start(); diff --git a/src/Commands/StartRoadRunnerCommand.php b/src/Commands/StartRoadRunnerCommand.php index 8f7567904..21171f259 100644 --- a/src/Commands/StartRoadRunnerCommand.php +++ b/src/Commands/StartRoadRunnerCommand.php @@ -99,6 +99,7 @@ public function handle(ServerProcessInspector $inspector, ServerStateFile $serve 'APP_ENV' => app()->environment(), 'APP_BASE_PATH' => base_path(), 'LARAVEL_OCTANE' => 1, + 'COMPOSER_VENDOR_DIR' => config('octane.vendor_path'), ]))->start(); $serverStateFile->writeProcessId($server->getPid()); diff --git a/src/Commands/StartSwooleCommand.php b/src/Commands/StartSwooleCommand.php index 4d31dbc3a..28ff45938 100644 --- a/src/Commands/StartSwooleCommand.php +++ b/src/Commands/StartSwooleCommand.php @@ -87,6 +87,7 @@ public function handle( 'APP_ENV' => app()->environment(), 'APP_BASE_PATH' => base_path(), 'LARAVEL_OCTANE' => 1, + 'COMPOSER_VENDOR_DIR' => config('octane.vendor_path'), ]))->start(); return $this->runServer($server, $inspector, 'swoole');