Loading...

Knowledge Base
Save up to  70% off.  Start your website today!

phpinfo

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

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


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

  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. At the top-right menu, click +File.

    cPanel - File Manager - New File

  5. Enter phpinfo.php when prompted to create a new file. You can name it anything; phpinfo.php is 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 ensure you are in the correct directory for addon domains when creating a phpinfo.php file.

  1. Go to the 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, which is 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 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 cPanel, you can 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 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.


Did you find this article helpful?

 
* Your feedback is too short

Loading...