brycekmartin Posted June 9, 2010 Share Posted June 9, 2010 I'm working on a project and I want to automate the process of adding an <virtual host></virtual host> entry into httpd.conf. What I was thinking is that I could find the last instance of </virtual host> in the file and then add my new record after that. The problem, is how do I position to the last instance of </virtual host> in the file? Once I have the pointer set its easy to write to the file. Any help will be appreciated. Thanks Bryce Quote Link to comment https://forums.phpfreaks.com/topic/204246-editing-httpdconf-with-php/ Share on other sites More sharing options...
trq Posted June 9, 2010 Share Posted June 9, 2010 There is an Include directive available within the Apache config files. This directive also allows wildcards. So, you could use something like.... Include /var/www/vhosts/*.conf Within your httpd.conf file. This would make it much easier as you could now use php to simply create new .conf files (one for each vhost) within /var/www/vhosts This is similar to how my CMS used to work. Quote Link to comment https://forums.phpfreaks.com/topic/204246-editing-httpdconf-with-php/#findComment-1069738 Share on other sites More sharing options...
brycekmartin Posted June 9, 2010 Author Share Posted June 9, 2010 Hey thorpe, Great idea. I think that is exactly what I will do. Bryce Quote Link to comment https://forums.phpfreaks.com/topic/204246-editing-httpdconf-with-php/#findComment-1069740 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.