Closed carestad closed 3 years ago
Unfortunately, because Octane is started from the "CLI", there is not real way of mutating the SAPI PHP module. So all php core functions, based on that module, including phpinfo
, will work a little bit differently.
for me it works with
ob_start();
phpinfo();
$phpinfo = ob_get_clean();
return response($phpinfo, 200)
->header('Content-Type', 'text/html');
Description:
phpinfo()
output is missing markup whtn called from a controller method or route closure.php_sapi_name()
is alsocli
where forartisan:serve
it would becli-server
. This happens with both Swoole and Roadrunner.Steps To Reproduce:
Example route:
When "hosting" with
artisan serve
, navigating to/phpinfo
will show a colourful output. CTRL+U (view source) reveals a lot of markup and styling involved.When hosting with
artisan octane:start
, the output is stripped of markup and is the same as when callingphpinfo()
from CLI, like tinker or a simple script run from the command line. Output ofphp_sapi_name()
also sayscli
at this point, which would explain it.Simple workaround for now to at least get some structure to the page is to rewrite route like this: