subdomain creation

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
reverend_ink
Forum Contributor
Posts: 151
Joined: Sun Apr 20, 2003 1:18 am
Location: Las Vegas | London

subdomain creation

Post by reverend_ink »

I am wordering if anyone here knows how to automate the creation of a subdomain with a php script?

I am using apache as well.

I am running linux on the server with php 4.3X

Thanks all!
reverend_ink
Forum Contributor
Posts: 151
Joined: Sun Apr 20, 2003 1:18 am
Location: Las Vegas | London

Post by reverend_ink »

I am thinking I might have to edit the DNS zone, but what I want to do is create a subdomain based on a user's new folder within the domain...

so user's new domain WOULD be http://www.mydomain.com/userfolder and what I need to do is create a subdomain automatically at userfolder.mydomain.com
kettle_drum
DevNet Resident
Posts: 1150
Joined: Sun Jul 20, 2003 9:25 pm
Location: West Yorkshire, England

Post by kettle_drum »

Just get the php script to add a virtualhost to the httpd config. Its probably best to have a seperate file for all users, and then in the httpd.conf file, simply include these files - that way your not writting to the conf file directly.

You then need to restart apache for it to read the new config - and you have your sub-domain.
reverend_ink
Forum Contributor
Posts: 151
Joined: Sun Apr 20, 2003 1:18 am
Location: Las Vegas | London

Post by reverend_ink »

to expand I am making a script for someone to add users, may not be predefined names...

think I could right this into a "subdomain".conf file?

and then in httpd.conf have include "subdomain".conf?

and when they make a new user the "subdomain".conf is appended with
<virutal host=$subdomain.mydomain.com> and then restart apache?

Or something pretty similar
Post Reply