phpinfo() Function
phpinfo() is a built-in PHP function that outputs detailed information about your PHP installation, including version, loaded modules, configuration settings, and server environment.
View your PHP info:
http://localhost/phpinfo.php
Create the file first (see below)
How to Use phpinfo()
Create a file named phpinfo.php in your htdocs folder:
<?php
phpinfo();
?>
Then open http://localhost/phpinfo.php in your browser.
What phpinfo() Shows
- PHP Version — Current PHP version installed
- Server API — How PHP connects to web server
- Loaded Modules — Extensions like mysqli, curl, gd
- php.ini Location — Configuration file path
- Memory Limit — Max memory PHP can use
- Upload Limits — Max file upload size
phpinfo() Parameters
| Constant | Shows |
|---|---|
| INFO_GENERAL | PHP version, build date |
| INFO_CONFIGURATION | php.ini settings |
| INFO_MODULES | Loaded extensions |
| INFO_ENVIRONMENT | Environment variables |
| INFO_ALL | Everything (default) |
Security Warning: Delete phpinfo.php from production servers — it exposes sensitive configuration details.
Common Uses
- Check if specific PHP extensions are installed
- Find php.ini location to edit settings
- Verify upload_max_filesize and post_max_size
- Debug PHP configuration issues