I have a conf file(httpd.conf) and wish to open the file look for a multiple line config (virtual host setting) and either edit, replace or delete the text.
I know how to add a virtual host to the file via php but I dont know how to get the script to find say an exist out of date setting and delete everything out for a removal of a virtual host.
To explain what I need have a look at the following. I have a text file httpd.conf with the following lines somewhere within it.
#virtualhost setting for theseen
<VirtualHost 150.101.238.50>
ServerAdmin admin@theseen.dhs.org
DocumentRoot /home/theseen/public_html
ServerName www.theseen.dhs.org
ServerAlias theseen.dhs.org
ErrorLog /home/theseen/logs/error_log
CustomLog /home/theseen/logs/access_log common
Options All
</VirtualHost>
#endofhost
I would like to search for the line "#virtualhost setting for theseen" then search for the ending "#endofhost" and delete all text in between.
A did see something like this in a code snippet but I cant find it.
Any help will be appreciated
Cyberfez