How to create a phpinfo page for troubleshooting

Ella McMorran
phpinfo() outputs everything about your PHP configuration - versions, modules, settings, environment variables. Essential for debugging but also a security risk if left exposed.
Creating the phpinfo file
- Log into your domain’s cPanel account (not WHM reseller panel)
 - Open File Manager from the Files section
 - Navigate to your domain’s document root:
- Main domain: 
public_html - Addon domain: 
public_html/addondomain - Subdomain: 
public_html/subdomain 
 - Main domain: 
 
Important: Different directories can have different PHP configurations through .htaccess or MultiPHP settings. Create the phpinfo file in the exact location where you’re experiencing issues.
- Click “New File” in the top menu
 - Name the file 
phpinfo.php(or something less obvious likeinfo-temp-2024.phpfor security) - Right-click the new file and select “Edit”
 - If prompted for encoding, select UTF-8
 - Add this code:
<?php
// Remove this file after troubleshooting!
phpinfo();
?> - Save the file
 
Viewing PHP information
Navigate to http://yourdomain.com/phpinfo.php (replace with your actual domain and filename).
You’ll see comprehensive information including:
- PHP version and build date
 - Loaded configuration files
 - Enabled/disabled modules
 - Memory limits and execution times
 - Environment variables
 - Server information
 
What to look for
Common troubleshooting checks:
memory_limit: Insufficient memory causes white screensmax_execution_time: Too low causes timeout errorsupload_max_filesize: Limits file upload sizespost_max_size: Must be larger than upload_max_filesize- Module status: Check if required extensions (mysqli, curl, gd) are enabled
 
Security warning
DELETE THE PHPINFO FILE IMMEDIATELY AFTER USE
phpinfo() exposes sensitive server information including:
- Server paths and configuration
 - Environment variables
 - PHP version vulnerabilities
 - Loaded modules and versions
 
Hackers actively scan for phpinfo.php files. Name yours uniquely and remove it within minutes of troubleshooting.
Alternative: Command line method
If you have SSH access, this is safer:
php -i > phpinfo.txtThen review the text file locally without exposing it via web.
