[SWLUG] Restart Apache from php

Terry John terry.john at bbc.co.uk
Fri Jan 21 15:59:40 UTC 2005


All this assumed that you have a DNS somewhere configured with all your
virtual host names pointing to the IP address of your server. If the
answer is "No", or "Oh sh!t I never thought of that" then consider
port-based virtual hosting. Not entirely sure if Apache 2 supports them
but I used them on Apache 1.3

Using PHP to alter a mysql database and a perl script to read it (& I
guess error/hacking check it) is to my mind a good idea.

Terry

-----Original Message-----
From: discuss-bounces at swlug.org.uk [mailto:discuss-bounces at swlug.org.uk]
On Behalf Of Dick Porter
Sent: 21 January 2005 15:08
To: discuss at swlug.org.uk
Subject: Re: [SWLUG] Restart Apache from php


On Fri, 2005-01-21 at 14:27 +0000, Toby Maxwell-Lyte wrote:
> On 21 Jan 2005 at 13:54, justin at discordia.org.uk wrote:
> 
> > On 21 Jan, Toby Maxwell-Lyte wrote:
> > > I guess I could store the desired domain names in a mysql db. I 
> > > could write a perl script that checked this db for entries and 
> > > then created new virtual hosts accordingly. I could then setup a 
> > > cronjob to run this script every 5 minutes.
> > 
> > Apache does have support for multiple VirtualHosts without needing 
> > any config file changes or restarting.
> > 
> > ive never tried it myself, but read here 
> > http://httpd.apache.org/docs-2.0/vhosts/mass.html
> 
> Thanks, I had seen that and unfortuantely the sites are not
> necessarily stored in a directory that matches the domain name. The 
> sites are created dynamically therefore they're stored in directories 
> that have an integer that increases in value for each new site. This 
> makes it far easier for programmatic reasons. 

If you need a unique key, then surely the domain name is unique?

If you absolutely have to have a numeric directory, then a 5-minute cron
job that looks up the list of domain names in your database and links
them to the directory (with the appropriate symlink handling in
httpd.conf) will be a lot easier.

- Dick


_______________________________________________
SWLUG Discussion List - Discuss at swlug.org.uk
http://list.swlug.org.uk/mailman/listinfo/discuss

http://www.bbc.co.uk/

This e-mail (and any attachments) is confidential and may contain
personal views which are not the views of the BBC unless specifically
stated.
If you have received it in error, please delete it from your system. 
Do not use, copy or disclose the information in any way nor act in
reliance on it and notify the sender immediately. Please note that the
BBC monitors e-mails sent or received. 
Further communication will signify your consent to this.




More information about the Swlug mailing list