tibberous Posted August 29, 2008 Share Posted August 29, 2008 I am trying to create dynamically subdomains. From what I read, there are three ways to do it: mod_rewrite mod_vhost_alias PHP, changing the apache config and restarting the server I'm also thinking their is a forth way. Since my server runs WHM, I can probably create subdomains through WHM command line, though that might just be a wrapper version of method 3. Now, way three seems like it could be quirky. I already have subdomains, but if I make a CNAME for *.mydomain, that is used before existingsubdomain.mydomain right? Does anyone know the best way to do this dynamically? I think I'm going to look more at mod_vhost_alias, because that seems to be the one I can find the least about. Quote Link to comment https://forums.phpfreaks.com/topic/121808-subdomains-and-ip-pointing/ Share on other sites More sharing options...
JonnoTheDev Posted August 29, 2008 Share Posted August 29, 2008 You can extend the WHM API to do this. Generate an API access key in WHM to allow your php script to talk to the server. Quote Link to comment https://forums.phpfreaks.com/topic/121808-subdomains-and-ip-pointing/#findComment-628617 Share on other sites More sharing options...
tibberous Posted August 29, 2008 Author Share Posted August 29, 2008 Do you know how? I looked at the WHM 11 docs but couldn't find anything about creating a subdomain. Whats worse is that I don't think my dns is setup right. I setup a record for: *.trenttompkins.com. A 72.29.86.138 But if I set my ServerAlias to *.trenttompkins.com it only works for subdomains that I have already created. Am I missing something? Quote Link to comment https://forums.phpfreaks.com/topic/121808-subdomains-and-ip-pointing/#findComment-628688 Share on other sites More sharing options...
JonnoTheDev Posted August 29, 2008 Share Posted August 29, 2008 All WHM functionality, creating accounts, dns records, subdomains, etc are basically done via perl files in the core of the system. The API will call on the files dependent on what you are doing i.e. createAcct() - create an account. If the API has no method for creating subdomains then you will need to extend the API to do this. Not sure what version of WHM it was at the time but I extended the API to allow more functionality via remote calls. This was for a webhosting company who used WHM servers for customer hosting that wanted to give the users more control over their hosting accounts via the company website and strip the functionality away from the cPanel system. You will need to research this yourself as its not a case of posting a bit of code here to make it work for you. At the time I dont think the documentation gave much info on the API itself so it was a case of figuring it out. Quote Link to comment https://forums.phpfreaks.com/topic/121808-subdomains-and-ip-pointing/#findComment-628711 Share on other sites More sharing options...
tibberous Posted August 29, 2008 Author Share Posted August 29, 2008 http://forums.cpanel.net/showthread.php?t=72445&highlight=subdomain Quote Link to comment https://forums.phpfreaks.com/topic/121808-subdomains-and-ip-pointing/#findComment-628737 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.