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.
Program/Source Code:
The source code to print the version of CGI used by the webserver is given below. The given program is compiled and executed successfully.
Output:
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.
need an explanation for this answer? contact us directly to get an explanation for this answer