[SWLUG] Restart Apache from php

Robert McQueen robot101 at debian.org
Sun Jan 23 13:30:34 UTC 2005


Toby Maxwell-Lyte wrote:
> 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. 
> 
> e.g. www.example.com
> points to /data/www/html/sites/site345/
> 
> www.tester.com 
> points to /data/www/html/sites/site462/

An alternative approach that we use is a mod_rewrite recipe from 
http://httpd.apache.org/docs/misc/rewriteguide.html (see Mass Virtual 
Hosting). This lets you list domain -> directory pairs in a map which 
apache reloads at runtime without needing to be restarted. You can then 
either write this file out from your frontend (but having it writable by 
scripts running on your webserver might be bad...), or have some backend 
thing which runs periodically or on demand and writes a new file out if 
there are new domains.

> Cheers for the help though. I must admit the php -> mysql -> perl -> 
> cronjob idea is sounding the most applicable at the moment...
> 
> Thanks
> Toby

Regards,
Rob



More information about the Swlug mailing list