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:
- What Are the Benefits of Using the Latest PHP Version?
- How to Create a phpinfo.php File
- How To Change Your PHP Version and Settings
- How to View the phpinfo.php File
What Are the Benefits of Using the Latest PHP Version?
With the release of newer versions of PHP, certain features like security and performance have improved. Since PHP versions 5.4 and older were not getting updates anymore, your website could be exposed to possible security threats. Thus, it is strongly recommended to get your websites updated with the latest PHP version to keep it running smoothly and enjoy the new features for flexibility and future website development. That being said, it is still essential to use a PHP version that is compatible with your website’s scripts and components.
Some websites are still using PHP versions 5.4 and older, and before switching to the latest PHP version, checking your current PHP versions should be your first step. The phpinfo.php file is one way of verifying the current PHP version and settings of your website.
How to Create a phpinfo.php File
- In the public_html folder of your site, create a file named phpinfo.php. For addon domains, create the phpinfo.php file inside its directory root.
- Insert 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. ?>
How To Change Your PHP Version and Settings
The cPanel gives you 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.
Aside from updating the PHP version, the cPanel also has the ability to change your PHP settings. Please refer to this article for instructions on how to change your PHP settings.
How to View the phpinfo.php File
- Open an internet browser.
- Type the following into your browser’s address bar.
*Be sure to replace "example.com" with your actual domain name.