Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

How to create subdomains for domains via a php script?

Discussion in 'cPanel Developers' started by kasutajanimi, Aug 19, 2015.

  1. kasutajanimi

    kasutajanimi Registered

    Joined:
    Aug 19, 2015
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Estonia
    cPanel Access Level:
    Website Owner
    Hey!

    What I want to do is to run a php script to which I feed in a list of subdomain names and then it would automatically create those subdomains for a specified domain (and connect those subdomains with folders on my hosting account).
     
    #1 kasutajanimi, Aug 19, 2015
    Last edited by a moderator: Aug 19, 2015
  2. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,749
    Likes Received:
    1,886
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
    kasutajanimi likes this.
  3. whatsapprank

    whatsapprank Registered

    Joined:
    Aug 19, 2015
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    delhi
    cPanel Access Level:
    Root Administrator
    I think you may be talking about a virtual domain in which case you need to create a new DNS entry in the named file as well as a new VirtualHost container in the httpd.conf file.
     
  4. RyanBVI

    RyanBVI Member

    Joined:
    Sep 4, 2015
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    BVI
    cPanel Access Level:
    Root Administrator
    If you have an MVC php application with managable routes,
    maybe you would also find useful the wildcard DNS,
    so that ALL subdomains point to a specific php file / router,
    so you can programmatically further control the execution ...

    (In cPanel, add a subdomain with: * and point it to have document root
    to the folder that you have an index.php that serves as your "router"...)
     
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice