Updated: 12 November 2026 · Applies to: PHP 8.4 with Apache 2.4 (tested on Debian 13), cPanel and WHM File Manager
A PHP info file is a one-line PHP script that calls phpinfo(). Save this as a file with a .php extension in your website folder and open it in the browser:
<?php phpinfo();
The page shows the PHP version your site really runs, which php.ini is loaded, every setting (such as memory_limit and upload_max_filesize) and the loaded extensions. Delete the file as soon as you have the information you need: it shows server paths, versions, environment variables and request headers that help an attacker plan an attack.
Create a PHP info file in cPanel
- Log in to cPanel and open Files > File Manager.
- Open
public_html, or the document root of the addon domain or subdomain you want to check. Each domain can run its own PHP version, so create the file in the folder of the site you are testing. - Click + File. Give it a name that is hard to guess, for example
info-7f3a.php, notphpinfo.phporinfo.php, which bots scan for. Click Create New File. - Select the new file, click Edit, paste the line
<?php phpinfo();and click Save Changes. - Open the file in your browser, for example
https://example.com/info-7f3a.php. - When you have finished, select the file in File Manager and click Delete.
On a VPS or dedicated server you can create the same file from SSH. On Debian or Ubuntu the default web root is /var/www/html:
echo '<?php phpinfo();' > /var/www/html/info-7f3a.php
And remove it afterwards:
rm /var/www/html/info-7f3a.php
What to look for on the page
- PHP Version at the top: the version serving this site. In our test the page title read
PHP 8.4.27 - phpinfo(). - Server API: how PHP runs, for example
Apache 2.0 HandlerorFPM/FastCGI. This decides whether settings can go in.htaccessor need.user.iniorphp.ini. - Loaded Configuration File: the
php.iniin use. Our test server showed/etc/php/8.4/apache2/php.ini. - The Core section: settings such as
memory_limit,max_execution_time,post_max_sizeandupload_max_filesize. The Local Value column is what applies to this folder; Master Value is the server default. - One section per extension (for example
curl,mysqli,gd,intl). If an application says an extension is missing and there is no section for it, it is not loaded for this site.
To change the PHP version or settings for a cPanel site, see How to Check Your PHP Version in cPanel and Change It.
Show only part of the information
According to the PHP manual, phpinfo() takes an optional flag. For example, only the loaded extensions and their settings:
<?php phpinfo(INFO_MODULES);
Other flags include INFO_GENERAL (version, build, php.ini location) and INFO_CONFIGURATION (local and master values of every setting). Combine them with |:
<?php phpinfo(INFO_GENERAL | INFO_CONFIGURATION);
If you only need the version and the php.ini path, a smaller script reveals far less:
<?php echo PHP_VERSION, "\n"; echo php_ini_loaded_file(), "\n"; echo php_sapi_name(), "\n";
Output on our test server:
8.4.27 /etc/php/8.4/apache2/php.ini apache2handler
Restrict the file to your own IP address
If you need to keep the file for a while, put it in its own folder and allow only your IP address in that folder's .htaccess (Apache 2.4 syntax; replace the documentation address with your own public IP):
<Files "info-7f3a.php">
Require ip 203.0.113.10
</Files>
In our test, a request from any other address got 403 Forbidden. This is a stopgap: deleting the file is still the safe end state.
Check PHP from the command line instead
With SSH or cPanel's Terminal, you can read the same information without a public file:
php -i | grep -E "^PHP Version|^Loaded Configuration File"
List the loaded extensions:
php -m
Be aware that the command line often uses a different php.ini (and on cPanel servers, sometimes a different PHP version) from the website. Our test server showed /etc/php/8.4/cli/php.ini on the command line but /etc/php/8.4/apache2/php.ini in the browser. When you troubleshoot a website, the browser page is the one that counts.