Skip to content

Commit

Permalink
FrankenPHP: Allow running Octane without artisan command (#968)
Browse files Browse the repository at this point in the history
* FrankenPHP: Set defaults for APP_BASE_PATH, APP_PUBLIC_PATH and MAX_REQUESTS.

* Checks env before server.

* style.ci

* Update frankenphp-worker.php

---------

Co-authored-by: a.stecher <a.stecher@sportradar.com>
Co-authored-by: Taylor Otwell <taylor@laravel.com>
  • Loading branch information
3 people authored Nov 25, 2024
1 parent 4dc701b commit b8b11ef
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion bin/frankenphp-worker.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

$worker = null;
$requestCount = 0;
$maxRequests = $_ENV['MAX_REQUESTS'] ?? $_SERVER['MAX_REQUESTS'];
$maxRequests = $_ENV['MAX_REQUESTS'] ?? $_SERVER['MAX_REQUESTS'] ?? 1000;
$requestMaxExecutionTime = $_ENV['REQUEST_MAX_EXECUTION_TIME'] ?? $_SERVER['REQUEST_MAX_EXECUTION_TIME'] ?? null;

if (PHP_OS_FAMILY === 'Linux' && ! is_null($requestMaxExecutionTime)) {
Expand Down
4 changes: 4 additions & 0 deletions src/Commands/stubs/frankenphp-worker.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
<?php

// Set a default for the application base path and public path if they are missing...
$_SERVER['APP_BASE_PATH'] = $_ENV['APP_BASE_PATH'] ?? $_SERVER['APP_BASE_PATH'] ?? __DIR__.'/..';
$_SERVER['APP_PUBLIC_PATH'] = $_ENV['APP_PUBLIC_PATH'] ?? $_SERVER['APP_BASE_PATH'] ?? __DIR__;

require __DIR__.'/../vendor/laravel/octane/bin/frankenphp-worker.php';

0 comments on commit b8b11ef

Please # to comment.