function SystemInfoController::php

Same name in other branches
  1. 8.9.x core/modules/system/src/Controller/SystemInfoController.php \Drupal\system\Controller\SystemInfoController::php()
  2. 10 core/modules/system/src/Controller/SystemInfoController.php \Drupal\system\Controller\SystemInfoController::php()
  3. 11.x core/modules/system/src/Controller/SystemInfoController.php \Drupal\system\Controller\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 59

Class

SystemInfoController
Returns responses for System Info routes.

Namespace

Drupal\system\Controller

Code

public function php() {
    if (function_exists('phpinfo')) {
        ob_start();
        phpinfo(~(INFO_VARIABLES | INFO_ENVIRONMENT));
        $output = ob_get_clean();
    }
    else {
        $output = t('The phpinfo() function has been disabled for security reasons. For more information, visit <a href=":phpinfo">Enabling and disabling phpinfo()</a> handbook page.', [
            ':phpinfo' => 'https://www.drupal.org/node/243993',
        ]);
    }
    return new Response($output);
}

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