PHP Tutorial

PHP Examples

PHP Practice

PHP program to print the version of CGI used by the webserver

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

Getting CGI Version in PHP

Here, we will use $_SERVER['GATEWAY_INTERFACE'] superglobal to get the version of Common Gateway Interface (CGI) used by the webserver.

PHP code to print the CGI version used by the webserver

The source code to print the version of CGI used by the webserver is given below. The given program is compiled and executed successfully.

<?php
//PHP program to print the version of CGI 
//used by web server.

$version = $_SERVER['GATEWAY_INTERFACE'];

printf("CGI Version: %s<br>", $version);
?>

Output

CGI Version: CGI/1.1

Explanation

In the above program, we used $_SERVER['GATEWAY_INTERFACE'] super global that returns the version of  Common Gateway Interface (CGI) used by the web server, which is assigned to the variable $version. After that, we printed the CGI version using printf() on the webpage.

More PHP Programs »





Comments and Discussions!

Load comments ↻





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