What is a phpinfo file and how to create it
A phpinfo.php file is a file that makes it easier for you to see PHP information about the server you are hosted on.
If you’re not familiar with how to create a php page, follow the steps below to create a phpinfo page using your File Manager.
- Log into your cPanel.
- Open your File Manager.
- Navigate to the directory you are working with. This is important because each folder can actually be set to have different php settings. In this example, we are viewing the php settings for our main domain, so we are navigating to the public_html folder.
- In the top menu, click New File.
- When prompted for the file name, enter phpinfo.php (it can actually be named anything, phpinfo.php is simply a common name for the file).
- Find the phpinfo.php file in your list of files (it should have automatically updated). Right click on it and choose “Edit”. If you see a “Text Editor” prompt, choose “utf-8” from the drop down list and then click “Edit”.
- Enter the following text: <? phpinfo(); ?>
Then click Save Changes.
While it doesn’t include version information about your database scheme, it does include version information about PHP, Apache/IIS, GD, and other things. It also contains a description of many important settings, which could possibly be causing problems with your php script installation.
What information can I get from phpinfo
A phpinfo file provides comprehensive information about the PHP configuration and settings on a server. Here are some of the key pieces of information you can gather from a phpinfo file:
PHP Version: The phpinfo file displays the version of PHP installed on the server. This information is important for compatibility with PHP scripts and applications.
Configuration Settings: It provides details about the PHP configuration settings, including directives related to error handling, file uploads, session management, and more.
- Loaded Extensions: You can see a list of all the PHP extensions that are currently loaded and enabled on the server. This is useful for verifying if specific extensions required by your application are available.
- Server Information: The phpinfo file displays information about the web server software running on the server, such as Apache or Nginx, along with its version.
- Environment Variables: It shows the environment variables available within the PHP environment. This includes information about the server, user, and other variables that can be useful for debugging and configuration purposes.
- PHP Modules: It lists the compiled-in modules and their respective configurations. These modules provide additional functionality to PHP, such as database connectivity or encryption.
- PHP Directives: The file provides a complete list of PHP directives and their current values. These directives control various aspects of PHP behavior, such as memory limits, error reporting, and execution time.
- Loaded Configuration File: You can find the path to the PHP configuration file (php.ini) being used by the server. This allows you to locate and modify the configuration settings if needed.
Overall, the phpinfo file provides an extensive overview of the PHP environment on the server, allowing you to troubleshoot issues, verify settings, and gather information for debugging purposes.