Cloud Service >> Knowledgebase >> General >> What information Does phpinfo Provide?
submit query

Cut Hosting Costs! Submit Query Today!

What information Does phpinfo Provide?

A unique feature of PHP, phpinfo is a web page that presents a mass of data related to PHP about the current state of its web environment. It shows a form in which configuration data, loaded extensions, environment variables, and other relevant content are available. Such information can be everything you need for debugging, editing, or enhancing your PHP app.

Whether you are looking to program, a designer trying to learn how to use a new web development language or a web administrator, the phpinfo page provides a complete overview of the following information.

  • PHP Version: This shows the PHP version installed on the server.

  • System Information: It displays the operating system type, server infrastructure, and other similar system parts.

  • Server Environment: It furnishes the necessary data relating to the software for servers (e.g., Apache and Nginx) and their configurations.

  • PHP Configuration: The actual settings of the PHP config are in view, including the path of files, limits, and other commands.

  • Loaded Extensions: The extension will display all the loaded server PHP extensions, particularly their versions and configurations.

  • Environment Variables: Exhibits the environment variables of the server and its values.

  • HTTP Headers: Listing of the request and response headers.

  • PHP License Information: Licenses the PHP under a PHP license and credits its crew.

How to Create a phpinfo Page

Developing an instant PHP general information page is a piece of cake. Follow these steps:

  1. Create a New PHP File: Open the text editor app and get a new file named phpinfo.php with an extension of .php.

  2. Add the phpinfo() Function: Inside the second file, paste down the following PHP code:

phpinfo();

?>

Therefore, the one-line command generates and displays the list of PHP settings on the phpinfo() page.

  1. Save the File: Make the initial phpinfo.php 'saving' in the web server's document root or any other directory the server could access.

  2. Access the phpinfo Page: Open a web browser and go to the one with the phpinfo.php URL as its base address. For example, if the file is saved in the document root, you can access it at http://www.your-website.com/phpinfo.php.

Accessing phpinfo on Shared Hosting

Since the shared hosting situation with the web host could have been forbidden, restrictions on the phpinfo page could have been put in place for security reasons. Therefore, when you presume the following methods can come in handy:

  1. Hosting Control Panel: Before that, you must confirm whether your hosting control panel (cPanel, Plesk, etc.) has the built-in phpinfo viewer or can generate the php info page itself.

  2. Contact Hosting Support: Contact the support person at your hosting company and ask for permission to access the phpinfo page or request direct help in producing it, if necessary.

Considerations and Best Practices

Python can be used as a tool in web development to do various tasks such as controll­ing an application or a website's flow of events and giving users a user­friendly way to interact with the data displayed on their screen. Consequently, it is of utmost importance to observe the suggested norms:

  1. Disable phpinfo in Production: Collect the data first, then remove the phpinfo script or deactivate it in your production environment. This is done to avoid exposing your site visitors to potential risks.

  2. Access Restrictions: If you need to keep the phpinfo page accessible, you should most likely implement access restrictions, including (IP) allowlisting or HTTP authentication, to reduce accessibility to authorized users or IP addresses.

  3. Regularly Update PHP: Ensure your PHP installation is up-to-date with the latest security patches and version updates to fight against potential vulnerabilities.

  4. Backup Configuration: While performing a meaningful change of your PHP PHP configuration, it's therefore helpful to record your current PHP configuration first to have this configuration for a reference or a purpose for restoration.

Conclusion

The phpinfo page serves as a convenient utility that reveals crucial information about the PHP suite and details about the server /host setup. All you need to do is carry out the steps discussed above to generate and have the phpinfo page required to get all the crucial information necessary during debugging and optimization of PHP-based web applications. 

 

On the other hand, an unknown person with malicious intent can find information from the phpinfo page by using unauthorized methods. Therefore, following best practices and adopting security measures to protect information exposed on the phpinfo page is of utmost importance.

Cut Hosting Costs! Submit Query Today!

Grow With Us

Let’s talk about the future, and make it happen!