# get ALL virtual hosts

- Thread: https://externals.io/message/14108
- Original archive: https://news-web.php.net/php.internals/14108
- Started by goetz@mrblackrose.de on 2004-12-17T07:15:12+00:00
- Messages: 1
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #14108 — goetz@mrblackrose.de — 2004-12-17T07:15:12+00:00

URL: https://externals.io/message/14108#14108

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
