Solaris doesn't have a setenv function.
I solved this problem by emulating it with putenv (can't remember where did I
take the source code from -- google was involved in that process for sure).
Add it in the beginning of phpstub.c file:

int setenv(const char *name, const char *value, int overwrite)
{
  int len;
  if (!overwrite && getenv(name)) return 0;
  len = strlen(name) + strlen(value) + 2;
  if (len < 255) {
    char buf[256];
    strcpy(buf, name);
    strcat(buf, "=");
    strcat(buf, value);
    return putenv(buf);
  } else {
    char *buf = malloc(len);
    strcpy(buf, name);
    strcat(buf, "=");
    strcat(buf, value);
    return putenv(buf);
  }
}


Note, that all this is not required when you're compiling phpstub for use with 
mathopd 1.4. Uncomment the "CPPFLAGS += -DPRESERVE_ENVIRON" line in Makefile then.

Best regards, 

Janusz

Reply via email to