This worked, problem solved:
(apparently it only understands a path but not a filename. and command-line
arguments didn't work for some reason.)

#include <stdio.h>

int main(int argc, char *argv[]){
        putenv("PHPRC=/a/custom/path/to/");
        execl("./php",argv[0],argv[1],0);
        return 0;
};

Thanks,
--Dmitri


----- Original Message -----
From: "Dmitri" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, February 04, 2003 7:01 PM
Subject: [PHP] overriding php.ini path in cgi


> Hi!
> I am trying to override php.ini filename for cgi scripts running through
the
> following setup:
>
> AddType php-script .php
> Action php-script /php4/php
>
> It is all working fine, but specifying alternative php.ini path does not
> work!
> I have tried the following solution:
> over.c:
> #include <stdio.h>
> int main(int argc, char *argv[]){
>         execl("./php",argv[0],"-c","/a/custom/path/to/php.ini",argv[1],0);
>         return 1;
> };
>
>
> It works as intended when launched from the command line, but when used
from
> Apache by the above directives, it does not work! (i also tried setting
the
> "PHPRC" environment variable, same results). Can anyone suggest why, or
how
> to override php.ini path otherwise?
>
> Thanks a lot,
> --Dmitri
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to