Re: virtual() call to CGI script

From: Date: Tue, 28 Aug 2001 16:14:10 +0000
Subject: Re: virtual() call to CGI script
References: 1 2 3 4 5 6 7  Groups: php.general 
Request: Send a blank email to php-general+get-64845@lists.php.net to get a copy of this message
> After testing this I see that: > > Apache uses the IP address of the remote host to determine whether to > allow or deny access. > > Even though PHP is running on localhost, and making a request via the > virtual() function, Apache still knows the IP address of the remote > host, and uses that. I didn't think of that I just did a test on my own server and used readfile("http://..../cgi-bin/test") where test just prints getenv("REMOTE_ADDR") and it prints the ip address of eth0, so you'd be able to do it this way - but I don't think using readfile() is as nice as virtual() in this case because readfile() performs another literal http request back to the server causing the use of another httpd process I think, whereas virtual() probably doesn't Another way you might be able to do it is find an environment variable that is only present when the cgi's are executed by the virtual() call, then use the apache SetEnvIf directive combined with <DirectoryMatch> jason

« previous php.general (#64845) next »