The phpinfo() function displays detailed information about your server’s PHP configuration. You can use it to verify PHP version, check loaded extensions, review memory limits or confirm that software requirements are met.
You will create a PHP file containing the phpinfo() function, access it through your browser to view your configuration and then remove the file to protect your server information.
public_html).You need to create a PHP file in your website’s root directory. This file will execute the phpinfo() function when accessed through a browser.

public_html directory. This is where your website files are stored.phpinfo.php and click Create New File.
phpinfo.php file and select Edit. Click Edit again in the confirmation dialogue that appears.
<?php phpinfo(); ?>

Your phpinfo file is now ready to use. The next step is to access it through your browser to view your PHP configuration.
You access the phpinfo file through your web browser. The page displays comprehensive details about your PHP installation, including version, loaded extensions and configuration directives.
https://yourdomain.co.uk/phpinfo.php, replacing yourdomain.co.uk with your actual domain name.
Once you have reviewed the information you need, you must remove the file. The phpinfo page exposes server configuration details that should not remain publicly accessible.
The phpinfo file contains sensitive server information. You should delete it immediately after checking your PHP settings to prevent unauthorised access to your configuration details.
public_html directory where you created the file.phpinfo.php and select Delete. Confirm the deletion when prompted.https://yourdomain.co.uk/phpinfo.php in your browser. You should see a 404 error, confirming the file has been removed.If you need to restrict access instead of deleting the file, you can use .htaccess rules to limit access to specific IP addresses. Create or edit the .htaccess file in your public_html directory and add:
<Files "phpinfo.php">
Order Deny,Allow
Deny from all
Allow from 192.168.1.1
</Files>
Replace 192.168.1.1 with your actual IP address. This prevents anyone except your specified IP from accessing the file.
You have checked your PHP settings using the phpinfo() function. You created a PHP file in your website root, accessed it through your browser to view your server configuration and removed the file to protect your server information.
Remember to delete phpinfo files after each use. If you need to check PHP settings regularly, create the file only when needed and remove it immediately afterwards. Our web hosting plans include cPanel access for managing your PHP configuration.
If you run into any trouble, get in touch and our team will be happy to help.
Launch your website with our reliable cPanel hosting with unlimited bandwidth and expert support.
Get cPanel Hosting