phpinfo
phpinfo() is a built-in function in PHP that, when called, renders a large HTML page with a complete report on the interpreter's current configuration. It is the fastest way to see exactly how PHP is set up on a given server.
How phpinfo() works
You simply create a file, for example info.php, containing <?php phpinfo(); and open it in a browser. PHP then prints organized tables covering, among other things: the PHP version number, the active runtime (such as PHP-FPM or CGI), the list of loaded extensions, and the values of directives from php.ini — like memory_limit, upload_max_filesize and max_execution_time — along with environment variables and server headers.
The function accepts an optional parameter to limit the report to a chosen section, for example only core configuration or only loaded modules. Its programmatic counterpart is phpversion(), useful when you need the version string alone.
Practical application
phpinfo() is a daily tool for administrators and developers: it confirms whether OPcache is enabled, whether a required extension is present (for a database driver or image processing, say), and that a change in php.ini was actually loaded after a service restart.
One security rule is non-negotiable: a phpinfo() report reveals environment details that are gold to an attacker, so a file containing it should never stay publicly reachable in production. Delete it or lock down access the moment your diagnostics are done. On managed Nodea servers the PHP configuration is surfaced securely inside the control panel, with no need to expose such a page to the internet at all.
Powiązane pojęcia
Najczęstsze pytania
Can I leave a phpinfo() file on the server?
No. A phpinfo() page exposes your PHP version, extension list, system paths and server configuration — all valuable to an attacker. Use the file once for diagnostics, then delete it or restrict access immediately after you finish checking.
