PHP settings can differ between websites and between the web server and command line. A temporary phpinfo() page shows the PHP version and configuration used when your chosen website handles a web request.
A phpinfo page exposes server and application configuration. Restrict access to your own IP or use an authenticated diagnostic location, and delete the file as soon as you finish.
Create a temporary diagnostic page
-
In cPanel, check the domain’s document root under Domains.
-
Open File Manager and navigate to that directory. It is not always
public_html. -
Create a new file named
phpinfo-check.php. Do not overwrite an existing file. -
Edit the file, add the following code and save it:
<?php phpinfo();
Check the version and remove the file
- Open
https://example.com/phpinfo-check.php, replacing the example domain with yours. Use the appropriate path if the file is in a protected subdirectory. - Check PHP Version and the configuration values you need.
- Delete the diagnostic file in File Manager.
- Confirm that its URL no longer displays the information. Remove any cached copy if a proxy or CDN cached the response.
The result applies to that website request. A command-line php -v result may use a different PHP installation.