The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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 Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    675
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
  3. whatsapprank

    whatsapprank Registered

    Joined:
    Aug 19, 2015
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    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