SCRIPT_FILENAME = The real path of the script being executed.
It is not a standard CGI env variable, but as I know it is set by default for both CGI and FastCGI on Apache HTTP Server.
And it is not difficult to implement.
--- nscgi/nscgi.c.orig 2023-11-06 12:23:44.338987736 +0800
+++ nscgi/nscgi.c 2023-11-06 12:24:24.339055534 +0800
@@ -814,6 +814,7 @@
*/
Ns_SetUpdateSz(cgiPtr->env, "SCRIPT_NAME", 11, cgiPtr->name, -1);
I think it is good to support SCRIPT_FILENAME variable.
Is there an application that needs this variable?
According to https://www.php.net/manual/en/reserved.variables.server.php scripts executed with the CLI (such as file.php or ../file.php), SCRIPT_FILENAME will contain the relative path specified by the user, otherwise the absolute pathname (not the requested file name, but the path on the file system). Is this also your expectation?
No. I just need the absolute path of the currently executing script (for CGI program).
There is now (since Nov 6) a change following your request in the repository:
https://github.com/naviserver-project/naviserver/commit/48c541c3ac647c1f45462d3c9dd90fbfbd7f1b48
Note, that this is not the usual source location (there is currently a problem on bitbucket with their changes in the licensing model). Furthermore, this change is in the main branch, whereas your diff above is from the release/4.99 branch. There are substantial changes in the main branch (to be used in the release 5.0 of NaviServer) including changes for nscgi to support running e.g. WordPress or Joomla inside NaviServer. See below for the updated documentation:
https://naviserver.sourceforge.io/5.0/nscgi/files/nscgi.html