PHP Tutorial

PHP Examples

PHP Practice

PHP program to print the version of the server software

Here, we are going to learn how to print the version of the server software in PHP?
Submitted by Nidhi, on November 24, 2020 [Last updated : March 14, 2023]

Getting Server Software's Version

Here, we will use $_SERVER['SERVER_SOFTWARE'] superglobal to get the version of server software and then print that on the webpage.

PHP code to get the server software version

The source code to print the version of the server software is given below. The given program is compiled and executed successfully.

<?php
//PHP program to print the version 
//of server software.

$ServerSoftware = $_SERVER['SERVER_SOFTWARE'];

printf("Server Software: %s<br>", $ServerSoftware);
?>

Output

Server Software: Apache/2.2.22 (Win64) PHP/5.3.13

Explanation

In the above program, we used $_SERVER['SERVER_SOFTWARE'] super global that returns the version of server software, which is assigned to the variable $ServerSoftware. After that, we printed the version of the server software on the webpage.

More PHP Programs »





Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.