# PHP Info Screen for Administrators

> Adds a Tools > PHP Info screen showing the full phpinfo() report (extensions, limits, configuration), handy when a host's control panel does not show it.

- Type: PHP
- Runs: Admin only
- Category: [Developer](https://wpide.com/library/category/developer/)
- Tags: php, server, debugging, tools
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/dev-phpinfo-page/

## Code

```php
add_action( 'admin_menu', function () {
    add_management_page( 'PHP Info', 'PHP Info', 'manage_options', 'wpide-phpinfo', function () {
        if ( ! current_user_can( 'manage_options' ) ) {
            return;
        }

        ob_start();
        phpinfo(); // phpcs:ignore WordPress.PHP.DevelopmentFunctions
        $info = (string) ob_get_clean();

        // Keep only the body and scope the table styles to this screen.
        if ( preg_match( '#<body[^>]*>(.*)</body>#is', $info, $match ) ) {
            $info = $match[1];
        }

        echo '<div class="wrap"><h1>PHP Info</h1><style>#wpide-phpinfo table{border-collapse:collapse;width:100%;margin-bottom:1em;background:#fff;}#wpide-phpinfo td,#wpide-phpinfo th{border:1px solid #dcdcde;padding:4px 8px;font-size:12px;vertical-align:top;word-break:break-word;}#wpide-phpinfo .e{background:#f6f7f7;font-weight:600;width:30%;}#wpide-phpinfo h2{margin-top:1.5em;}</style><div id="wpide-phpinfo">';
        echo wp_kses_post( $info );
        echo '</div></div>';
    } );
} );
```

## Notes

The report reveals server details; it is limited to administrators. Remove the snippet when you no longer need it.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "PHP Info Screen for Administrators" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
