phpinfo

 

In the phpinfo.php page, the PHP version can be seen at the top of the file and the current MySQL version.

You can also use phpinfo to check specific PHP settings such as safe_mode.

Jump to a Section:

What Are the Benefits of Using the Latest PHP Version?

Old PHP could leave your website exposed to possible security attacks. And you could be missing out on features like improved security and performance. We recommend that you stay up to date with the latest PHP so that your website runs smoothly and is ready for future website development. That being said, it is still essential to make sure your PHP version is compatible with your website’s scripts and components.


How to Create a phpinfo.php File for Primary Domain

You may find some links below that will take you directly to your cPanel provided that the following conditions are met:
  • You are logged into your Customer Portal. You can also log in after clicking the link.
  • The hosting package you are attempting to access is either Shared or Cloud. The link will only work for the first type of this package listed in the billing account.
  1. Log in to cPanel.
  2. In the cPanel's Files section, click on the File Manager icon.

    HostGator cPanel File Manager

  3. On the next page, locate and select public_html from the list.

    File Manager - public_html

  4. In the top-right menu, click +File.

    cPanel - File Manager - New File

  5. Enter phpinfo.php when prompted to create a new file. You can actually name it anything; phpinfo.php is just commonly used for this purpose.
  6. Select the Create New File button.
  7. Locate and right-click phpinfo.php from your list of files.
  8. Select Edit.
  9. Enter one of the following selections of code into the phpinfo.php file:

     Show All PHP Information  
    #Use the following code to show all the information about PHP.
    	<?php
    	phpinfo(); // This would be used to display all of the PHP information available for the installation.
    	?> 

    Show Installed Modules
    #Use the following code to see the installed modules and their current values.
    	<?php
    	phpinfo(INFO_MODULES); // This would be used to display the installed modules and their current values.
    	?> 

    Show php.ini Configurations
    #Use the following code to display the configurations you have set up through your php.ini or to review what's set up through the default configurations.
    	<?php
    	phpinfo(INFO_CONFIGURATION); // This would be used to display the configurations you have set up through your php.ini or to review what's set up through the default configurations.
    	?> 
  10. Click Save Changes.

Jump to How to View the phpinfo.php File


How to Create a phpinfo.php File for Addon Domains

You may want to make sure you are on the correct directory for addon domains when creating a phpinfo.php file.

  1. Go to the Addon Domains section of your cPanel.

    HostGator cPanel Addon Domain

  2. Locate the addon domain where you wish to create the phpinfo.php file.
  3. Click its document root.

    Addon Domain Modify Addon Domain

  4. Click +File found on the top-right menu to create a new file named phpinfo.php.

    cPanel - File Manager - New File

  5. Click Create New File.
  6. Right-click the phpinfo.php file and select Edit, then Edit again.
  7. Enter the code provided above.
  8. Once done, click Save Changes.

How to View the phpinfo.php File

  1. Open an internet browser.
  2. Type the following into your browser’s address bar.
    http://example.com/phpinfo.php
  3. The site's PHP version is located on the top of the phpinfo page.

    PHP version - phpinfo.php

*Be sure to replace "example.com" with your actual domain name.


How To Change PHP Version and Settings

Within the cPanel, you have the ability to change your website’s current PHP version. This is done through cPanel’s MultiPHP Manager. To know more about how to change your PHP version, please check out this video guide, or you may want to visit the article How to Update the PHP Version for detailed instructions.

Aside from updating the PHP version, you also can change the PHP settings in your cPanel. Please refer to this article for instructions on how to change your PHP settings.