function SystemInfoController::php

Returns the contents of phpinfo().

Return value

\Symfony\Component\HttpFoundation\Response A response object to be sent to the client.

1 string reference to 'SystemInfoController::php'
system.routing.yml in core/modules/system/system.routing.yml
core/modules/system/system.routing.yml

File

core/modules/system/src/Controller/SystemInfoController.php, line 63

Class

SystemInfoController
Returns responses for System Info routes.

Namespace

Drupal\system\Controller

Code

public function php() {
  if (function_exists('phpinfo')) {
    ob_start();
    $phpinfo_flags = Settings::get('sa_core_2023_004_phpinfo_flags', ~(INFO_VARIABLES | INFO_ENVIRONMENT));
    phpinfo($phpinfo_flags);
    $output = ob_get_clean();
  }
  else {
    $output = $this->t('The phpinfo() function is disabled. See <a href=":url" target="_blank">PHP documentation</a>.', [
      ':url' => 'https://www.php.net/manual/function.phpinfo.php',
    ]);
  }
  return new Response($output);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.