This is borderline programming, but i'm posting here first.
output of PHPinfo
apache2handler Apache Version Apache/2.2.3 (CentOS) Apache API Version 20051115 Server Administrator root@localhost Hostname:Port localdomain.com:0 User/Group apacheuser(500)/500
I'm trying to find a way for PHP to retrieve the "Hostname:port" field in this area.
We have apache dump all our virtual host information into a single file, and then that single file is broken up into several files & relevant information (total hits, ect) is logged to a database. One of the problems we're having at the moment is if a domain comes in on a ServerAlias, our php software isn't able to find the database table containing their logs (because the domain is technically not correct.) However, the "Hostname:port" field in php / phpinfo(); Always retrives the information i want, which is the primary domain name.
If there is any other method PHP can gain the "ServerName" field from apache i'm unaware of please let me know, as that would be alot easier.
An Alternative approach is having a SetEnv command in every virtual host, however instead of having to go through and add a
SetEnv primarydomain localdomain.com
to every VirtualHost, is there a way to use a variable?
SetEnv primarydomain %v
We solved the problem with a regular expression search & replace.