Menu

#92 Support SCRIPT_FILENAME (NSCGI)

Feature Request
open
nobody
None
5
2024-01-09
2023-11-06
No

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);
  • Ns_SetUpdateSz(cgiPtr->env, "SCRIPT_FILENAME", 15, cgiPtr->path, -1);
    if (cgiPtr->pathinfo != NULL && *cgiPtr->pathinfo != '\0') {
    Ns_DString tmp;

I think it is good to support SCRIPT_FILENAME variable.

Discussion

  • gustafn

    gustafn - 2023-11-06

    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?

     
  • Danilo Raynor

    Danilo Raynor - 2023-11-06

    No. I just need the absolute path of the currently executing script (for CGI program).

     

Log in to post a comment.