httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From o...@arcor.de
Subject [users@httpd] Environment variable set by "apr_env_set()" not accesible by C function "getenv()" within CGI program
Date Thu, 17 Mar 2016 19:38:33 GMT
Hi,

I have an Apache modul where I set an environment variable:

apr_env_set("FOO", "BAR", ...);

This variable is accesible by PHP:

<?php
    print(getenv("FOO")); // --> BAR
?>

but not by a simple CGI program written in C:

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char* argv[]) {
    printf("Content-Type: text/html;charset=utf-8\n\n");
    printf("%s", getenv("FOO")); /* --> NULL */
    return 0;
}

Other (standard) server variables like SERVER_NAME are accesible.

Apache Version 2.2.

Many thanks in advance.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message