I've got a VPS (CentOS) with CPanel and Suphp enabled. Apache/2..63 (Unix) mod_ssl/2..63 OpenSSL/.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5..2.2635 mod_fcgid/2.3.5

Like a root I produced a free account and hang up a website for this. Now I'm able to login for this account's CPanel and make addon domain names. For my project I wish to permit the site visitors of this site to complete same factor (create addon domain names) from the PHP script.

I suppose no one is able with PHP only, because it requires altering config files which PHP most likely doesn't have to do and I'm not sure if you can have the necessary rights for that PHP process. I suspect I must produce a command file and employ system() or similar PHP function to refer to it as. However I am unsure how you can give this command file enough privileges. Maybe there might be some user switch instructions and so the necessary stuff to alter config files... Please advise.


You have to give a DNS admission to point *.yourdomain.com for your application as well as your application should handle which page to exhibit in line with the worth of $_SERVER['HTTP_HOST']. To construct a method that allows finish-customers create accounts, I suppose you would need to give a column for your database to carry the subdomain they chose, after which show the right page.

I am unsure if CPanel allows you add wildcard DNS records. You'd need to speak to your host company for your.

OK, figured this out. With CPanel it is easy really: it offers the API for administrative tasks, which may be utilized in PHP scripts. http://etwiki.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/XmlApi

But let's say I do not have CPanel? Many VPS hosters either don't offer CPanel option or require additional fee every month for this. What you can do to automate creating addon domain names within this situation?