best way to programmatically add virtual hosts/domains to apache?

Discussion in 'Apache' started by jlrosine, Jun 29, 2007.

  1. #1
    Hey all, we are trying to figure out a way to manage our apache servers programmatically, preferrably from PHP. We want to be able to add virtual hosts, name or IP based, from PHP, and change/add/modify/delete information based on the domain name. Can anyone point me in the right direction to be able to do this? I know there are control panels that do this, but we really would rather program this in to our system, we have no use for all the extras of control panels.

    Thanks in advance
     
    jlrosine, Jun 29, 2007 IP
  2. ZenOswyn

    ZenOswyn Peon

    Messages:
    50
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    If you just need to add the information to the virtual hosting portion of the apache config files, and then restart apache.
     
    ZenOswyn, Jun 29, 2007 IP
  3. ndreamer

    ndreamer Guest

    Messages:
    339
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #3
    the cpanel i am using uses a include command in the main configuration file to a file thats just has virtual host information in it, you could just store the virtual hosts in a database then rewrite the file then setup a cron to execute every 12 hour or so if there is new entry's in the database.
     
    ndreamer, Jul 1, 2007 IP
  4. lkj

    lkj Peon

    Messages:
    729
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    0
    #4
    you can also include a directory I guess ;)
     
    lkj, Jul 7, 2007 IP