Q:

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

belongs to collection: PHP Miscellaneous

0

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

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

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.

<?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.

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

PHP Miscellaneous

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
PHP program to print the IP address of a hosted we... >>
<< PHP program to print the filename of the current e...