In the phpinfo.php page, the PHP version can be seen at the top of the file, as well as the current MySQL version.
You can also use phpinfo to check specific PHP settings such as safe_mode.
Jump to a Section:
- How to Create a phpinfo.php File for Primary Domain
- How to Create a phpinfo.php File for Addon Domains
- How to View the phpinfo.php File
- How To Change PHP Version and Settings
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 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.
- Log in to cPanel.
- In the cPanel's Files section, click on the File Manager icon.
- On the next page, locate and select public_html from the list.
- In the top-right menu, click +File.
- 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.
- Select the Create New File button.
- Locate and right-click phpinfo.php from your list of files.
- Select Edit.
- 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. ?>
- Click Save Changes.
Jump to How to View the phpinfo.php File
How to Create a phpinfo.php File for Addon Domains
For addon domains, you may want to make sure you are on the correct directory when creating a phpinfo.php file.
- Go to the Addon Domains section of your cPanel.
- Locate the addon domain where you wish to create the phpinfo.php file.
- Click its document root.
- Click +File found on the top-right menu to create a new file named phpinfo.php.
- Click Create New File.
- Right-click the phpinfo.php file and select Edit, then Edit again.
- Enter the code provided above.
- Once done, click Save Changes.
How to View the phpinfo.php File
- Open an internet browser.
- Type the following into your browser’s address bar.
- The site's PHP version is located on the top of the phpinfo page.
*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.