phpbar.de logo

Mailinglisten-Archive

[php] get ALL virtual hosts

[php] get ALL virtual hosts

Götz Lohmann goetz at mrblackrose.de
Fre Dez 17 08:15:12 CET 2004


Hi List,

I try to build up an apache module in C which interacts with an Apache 
Modul and stumbled over a curious thing.
I have several virtual hosts and wish to read a configuration of ONE of 
them. unfortunatly the call:

serv = SG(server_context)->r->server
for( ; serv ; serv->next) {
    serv->hostname
}

will result in different data.

Example httpd.conf:

...
<VirtualHost 127.0.0.1>
   ...
</VirtualHost>
<VirtualHost 127.0.0.2>
   ...
   mymod_enable=true
</VirtualHost>
<VirtualHost 127.0.0.3>
   ...
</VirtualHost>

If I call the PHP script at 127.0.0.3 I got:
127.0.0.3
127.0.0.2 = ON
127.0.0.1

But if I call the PHP script at 127.0.0.1 I got:
127.0.0.1

Am I stupid? Didn't  should give me

serv = SG(server_context)->r->server

always the first one ??? How to get the first if I'm the last other with 
"serv->next" cause there ist NO "serv->prev" :-(

regards
Goetz

php::bar PHP Wiki   -   Listenarchive