phpinfo example

protected function isSigchildEnabled(): bool
    {
        if (null !== self::$sigchild) {
            return self::$sigchild;
        }

        if (!\function_exists('phpinfo')) {
            return self::$sigchild = false;
        }

        ob_start();
        phpinfo(\INFO_GENERAL);

        return self::$sigchild = str_contains(ob_get_clean(), '--enable-sigchild');
    }

    /** * Reads pipes for the freshest output. * * @param string $caller The name of the method that needs fresh outputs * @param bool $blocking Whether to use blocking calls or not * * @throws LogicException in case output has been disabled or process is not started */
protected function isSigchildEnabled(): bool
    {
        if (null !== self::$sigchild) {
            return self::$sigchild;
        }

        if (!\function_exists('phpinfo')) {
            return self::$sigchild = false;
        }

        ob_start();
        phpinfo(\INFO_GENERAL);

        return self::$sigchild = str_contains(ob_get_clean(), '--enable-sigchild');
    }

    /** * Reads pipes for the freshest output. * * @param string $caller The name of the method that needs fresh outputs * @param bool $blocking Whether to use blocking calls or not * * @throws LogicException in case output has been disabled or process is not started */
if ( in_array( $mod$loaded_mods, true ) ) {
            return true;
        }
    }

    if ( empty( $loaded_mods )
        && function_exists( 'phpinfo' )
        && ! str_contains( ini_get( 'disable_functions' ), 'phpinfo' )
    ) {
        ob_start();
        phpinfo( INFO_MODULES );
        $phpinfo = ob_get_clean();

        if ( str_contains( $phpinfo$mod ) ) {
            return true;
        }
    }

    return $default_value;
}

/** * Checks if IIS 7+ supports pretty permalinks. * * @since 2.8.0 * * @global bool $is_iis7 * * @return bool Whether IIS7 supports permalinks. */

    public function phpinfoAction(): Response
    {
        $this->denyAccessIfProfilerDisabled();

        $this->cspHandler?->disableCsp();

        ob_start();
        phpinfo();
        $phpinfo = ob_get_clean();

        return new Response($phpinfo, 200, ['Content-Type' => 'text/html']);
    }

    /** * Displays the Xdebug info. * * @throws NotFoundHttpException */
    public function xdebugAction(): Response
    {

    public function infoAction()
    {
        $this->get('front')->Plugins()->ViewRenderer()->setNoRender();
        $_COOKIE = [];
        $_REQUEST = [];
        $_SERVER['HTTP_COOKIE'] = null;
        if (\function_exists('apache_setenv')) {
            apache_setenv('HTTP_COOKIE', '');
        }
        phpinfo();
    }

    /** * @return void */
    public function getOptimizersAction()
    {
        $optimizers = $this->get(OptimizerService::class)->getOptimizers();
        $optimizerResult = [];

        foreach ($optimizers as $optimizer) {
            
/** * Returns the contents of phpinfo(). * * @return \Symfony\Component\HttpFoundation\Response * A response object to be sent to the client. */
  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. For more information, visit the <a href=":phpinfo">Enabling and disabling phpinfo()</a> handbook page.', [':phpinfo' => 'https://www.drupal.org/node/243993']);
    }
    return new Response($output);
  }

}

    private static string $phpBin;
    private static ?Process $process = null;
    private static bool $sigchild;

    public static function setUpBeforeClass(): void
    {
        $phpBin = new PhpExecutableFinder();
        self::$phpBin = getenv('SYMFONY_PROCESS_PHP_TEST_BINARY') ?: ('phpdbg' === \PHP_SAPI ? 'php' : $phpBin->find());

        ob_start();
        phpinfo(\INFO_GENERAL);
        self::$sigchild = str_contains(ob_get_clean(), '--enable-sigchild');
    }

    protected function tearDown(): void
    {
        if (self::$process) {
            self::$process->stop(0);
            self::$process = null;
        }
    }

    
<?php declare(strict_types=1);
phpinfo();
Home | Imprint | This part of the site doesn't use cookies.