I'd like to mimic the behavior of sites-enabled on Linux, but utilizing Xampp on Windows, and I'm having some issues. I'm hoping someone can help.
On Linux its possible to put a PHPINIDIR directive within a specific virtual-host definition and have that value only used for the virtual host. This appears to work because the virtual host is a different "configuration tree", therefore each virtual host can have its own PHPINIDIR.
In the default Xampp installation there is a conf/extra/httpd-vhosts.conf where I can add my own virtual host definitions, but these are all loaded together. As a result it is "one configuration tree", and it errors out when I try to put a different PHPINIDIR directive within each different vhost definition (Because the variable is viewed as defined more than once).
I've been reading about mod_vhost_alias to see if I can do a conditional include.
e.g. Check if file exists based on the host name, if so load the configuration file. If not, load a default one.
<If "-f 'C:/dev/bin/xampp/apache/conf/vhosts/' . %0 . '/vhost.conf'">
Include "'C:/dev/bin/xampp/apache/conf/vhosts/' . %0 . '/vhost.conf'"
I don't know if my syntax is just wrong, or if vhost_alias_module only works on the Virtual Host directives to set the variables, but in either case the above errors out:
httpd: Syntax error on line 503 of C:/dev/bin/xampp/apache/conf/httpd.conf: Syntax error on line 43 of C:/dev/bin/xampp/apache/conf/extra/httpd-vhosts.conf: Invalid Include path 'C:/dev/bin/xampp/apache/conf/vhosts/' . %0 . '/vhost.conf'
I'm not sold on this specific solution, and I'm open to suggestions. I am hoping for a full unique vhost.conf file per host however, as I was hoping to be able to customize more than just the PHPINIDIR.
Nothing resembling this will work.
Configuration filenames are irrelevant though, it doesn't matter if you have 1 vhost in N files or N vhosts in 1 file. Either a directive can be specified in a virtualhost or not.
As to why your scheme does not work:
mod_vhost_alias'es %n variables are not available to any Apache other directives, just the ones provided by mod_vhost_alias.
Also, <If and anything related to mod_vhost_alias are interpreted at request-processing time, whereas Include is processed when the configuration file is read.
Invalid Include path For me it looks like a misformated path under widows:
Shouldn't it be sth. like
C:\dev\bin\... depending on how the software deals with backslashes?