In this article, we’ll show you how to create a phpinfo file. Also how to check its detailed information. For example, you might want to check whether your PHP configurations meet the requirements of any software you want to run on your server.
What is phpinfo?
phpinfo() is a function or a code snippet to determine the website’s PHP configuration. Here is some information that the PHP function displays after running phpinfo():
- A version of PHP the website is currently using.
- Server information and environment.
- Operating System version information.
- The PHP environment.
- HTTP headers.
- Modules and extensions.
- Master and local values.
- Paths along with php.ini location.
- The PHP License.
How To Create And Use a phpinfo File?
You often need to check PHP settings during web development. You can do this by running a script that calls the phpinfo() function. When you load the page in a web browser, the script shows all of the PHP configuration settings for your web site.
To use the phpinfo() function to view PHP settings:
- Login to cPanel.
- Navigate to File Manager under the Files section.
- Once you’re in public_html directory, click the New File button.
- Name your file phpinfo.php and press Create.
- Scroll down and locate the new phpinfo file within the directory, then right-click to Edit.
- After that, copy and paste the following code and press Save.
Note
The same result can be achieved by using any text editor on your computer. Create the phpinfo.php file by following the same steps from before, then uploading the file to your server’s public_html folder through an FTP client.
- Use your browser to go to http://test.com/phpinfo.php. where test.com represents your web site’s domain name. The page displays a large amount of information about the PHP installation.
Warning
For security reasons, you should disable any calls to the phpinfo() function when web site development and testing is complete.
Therefore, you can easily disable the file by giving it a different name. phpinfo.php_disabled, for instance.