I have a php webapp convention that I’d like to follow and a lot of setup for it is done in the apache configuration file.
Is there any way I can configure some strings that contain paths for multiple uses throughout the configuration file?
A dim example might be:
EnginePath = /opt/engine
AppPath = /opt/anapp
DocumentRoot [AppPath]/Public
CustomLog [AppPath]/Logs/Access.log combined
php_admin_value auto_prepend_file [EnginePath]/EngineBootstrap.php
As you can see, I have lots of opportunities to consolodate several repeted occurences of the system and app paths. This would make it easier to keep the configuration files as generic as possible, requiring a change in app or engine location to be edited once. Rather than several times per configuration file.
Thanks for any help!
As far as I know, this is not possible in apache configuration files.
However, what may be possible is for you to pre-process your httpd.conf file. I’ve used this technique with other configuration files, and it should work. For example, if you use php:
Save your httpd.conf.php
When you want to change your config, call:
This means you have to regenerate your conf file every time you want to make a change, but that can also be automated via some quick shell scripting.