Checking the PHP version for website, subdomain, and specific folders

Checking PHP version using files

A different PHP version can be applied to a specific folder or subdomain. To check, if the change was done correctly, all you need to do is access the folder which you would like to test. Then, create a new file with php extension, for example, phpinfo.php.

 

Add the following code to the file:

 

<?php
// Show all information, defaults to INFO_ALL
phpinfo();
?>

 

The file will look like this:

After this, access this file by URL. Just type your domain name, then the folder, and add the filename. For the file above, the path would be:

https://domain.tld/subdomain/phpinfo.php

The PHP version should be displayed at the top:

 

NOTE:

  • Changing PHP versions using files is not recommended, as it doesn't include PHP extensions and options. Thus, it might affect the website's work

Additional resources:

  • How to check the PHP configuration (info)

 

 

這篇文章有幫助嗎? 0 Users Found This Useful (0 Votes)