SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Zealot imagize's Avatar
    Join Date
    Oct 2004
    Location
    Australia
    Posts
    197
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP auto-make subdomains

    In the near future, im going to make a free webhosting script with automated signup etc (hopefully) like freewebs, hostultra etc and my question is. Can PHP automatically create accounts for people like sub domains etc or can i just make like

    mydomain.com/accountname

    and then some sort of htaccess file to make

    accountname.mydomain.com access mydomain.com/accountname

    etc

  2. #2
    SitePoint Addict loadx's Avatar
    Join Date
    Jul 2004
    Location
    Melbourne, VIC, Australia
    Posts
    221
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    checkout CPANEL it does all you say and you can write fowarding scripts to process its jobs.. basicly i think the way cpanel works is the gui dictates a bunch of cron jobs and that changes configs etc to make subdomains, ftp accounts, email addy's etc.

    PLESK is also another good tool.

  3. #3
    SitePoint Zealot imagize's Avatar
    Join Date
    Oct 2004
    Location
    Australia
    Posts
    197
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well i know hostultra does it automatically but they use perl(i think)

  4. #4
    Obsessive designer Infizi's Avatar
    Join Date
    May 2004
    Location
    North Pole
    Posts
    450
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    #!/usr/local/cpanel/3rdparty/bin/php

    <?php

    require '/usr/local/cpanel/Cpanel/Accounting.php.inc';
    $host = "localhost";
    $user = "(your CPANEL login)";
    $accesshash = '(generate in CPANEL)';

    createacct ($host,$user,$accesshash,$usessl (1 for remote or 0 for local),$acctdomain(sub.yourdoman.com),$acctuser,$acctpass,$acctplan);

  5. #5
    SitePoint Zealot imagize's Avatar
    Join Date
    Oct 2004
    Location
    Australia
    Posts
    197
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Infizi, but could you break this down to me a bit furthur, I've never used anything like this.

  6. #6
    SitePoint Wizard silver trophy someonewhois's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    6,364
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's just using the Remote WHM (web host manager) tols that Cpanel offers.

    Alternately you could edit the yourdomain.db record in the /usr/named/ (or /var/named/) file directly, adding the sub domain record.

    Of course, both these methods require root access on a server - I assume it's safe to assume that?

  7. #7
    SitePoint Zealot imagize's Avatar
    Join Date
    Oct 2004
    Location
    Australia
    Posts
    197
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yea, i have root

  8. #8
    SitePoint Wizard silver trophy someonewhois's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    6,364
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Then both methods will do you fine.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •