CGI (Common Gateway Interface) is a feature that allows the server to run scripts or executables in response to certain HTTP requests and return the script's output as the response. At the time of writing, this feature isn't very practical on most Android setups because Android has many limitations regarding running custom command-line programs. The most likely use case is if you manually install some interpreters on a rooted Android device. It is useful for dynamic content, form handling, or integrating with local tools. Note that CGI is not available when using some file access methods on Android (e.g. Storage Access Framework or Media Store); the File API is required.
CGI is enabled by checking the corresponding checkbox in the Handlers section of the app settings. When you enable it, you can configure how requests are mapped to scripts.
On the configuration screen you can set:
/cgi and the request path is /cgi/script.php, the script will be looked for in [cgi root]/script.php path.
You can set the file types that will be treated as CGI scripts. When a request is received, the server will check if the requested file has one of the specified file types. If it does, the server will treat it as a CGI script and run it. The script will be run with the following environment variables:
.php, the server will treat files with .php extension as CGI scripts.CGI and Simple. Difference between them is that in CGI mode the server trying to follow the CGI protocol (RFC 3875) while passing all the request data to the script as environment variables, while in Simple mode the server will simply transform url query parameters named "arg" as script arguments.python, the server will execute the script using Python interpreter.