Show the PHP configuration with phpinfo
Published
Updated
ℹ️
Debug PHP configuration details.
A file with <?php phpinfo(); in the root path shows the PHP version, extensions, settings and ENV vars in the browser. Delete it right after use, it exposes secrets.
Show phpinfo
phpinfo() prints the PHP version, the loaded extensions with their versions, all ini settings and the environment variables of the running PHP.
- Create a file
info.phpin the root path,weborpublicdepending on the software. - Put this line in it:
<?php phpinfo();php - Open
https://example.com/info.phpin the browser. - Delete the file when done.
To see only one part, pass a constant, such as phpinfo(INFO_MODULES) for the extensions. See phpinfo on php.net.
phpinfo in the terminal
Over SSH, php -i prints the same data as text. It shows the command line settings, which can differ from the settings of web requests. For a single value, use php -r 'echo ini_get("memory_limit");'.
phpinfo in a CMS
Craft CMS shows it in the control panel under Utilities → PHP Info. WordPress shows server details under Tools → Site Health → Info.
Keep phpinfo private
phpinfo shows every ENV var, including the database password and API keys. Never leave an info.php file on a public site. Bots request info.php and phpinfo.php on every domain. Delete the file right after use, or put the environment behind password protection while it exists. See ENV var security.
Change PHP settings in the PHP settings of the environment.