Need some subdomain creating scripts

Discussion in 'PHP' started by fuser, Jan 18, 2007.

  1. #1
    Hello,

    Looking for a script that creates a subdomain on the fly and dumps some information into the directory created.

    That is you would call the script say script.php?subdomain=sb and it would automatically create a directory, update any files needed to be updated, and dump some info in the directory.

    I actually came across some posts recommending rewriting to directories versus creating actual subdomains. Any downfalls to doing this? Any thoughts would be greatly appreciated.


    My configuration is fedora 5 with apache and plesk.


    Many Thanks
     
    fuser, Jan 18, 2007 IP
  2. ccoonen

    ccoonen Well-Known Member

    Messages:
    1,606
    Likes Received:
    71
    Best Answers:
    0
    Trophy Points:
    160
    #2
    Apache, you can use ModRewrite to emulate subdirectories. So when you hit the script, it could create the files on the fly, and update anything you want, just have them all DB driven.
     
    ccoonen, Jan 19, 2007 IP
  3. fuser

    fuser Peon

    Messages:
    541
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #3
    thanks for the reply. I have seen a lot of people recommending ModRewrite.

    Well, isn't it better to create a 'real' subdomain instead of using the modrewrite?
     
    fuser, Jan 20, 2007 IP
  4. peaforabrain

    peaforabrain Active Member

    Messages:
    45
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    63
    #4
    Here is a site that explains how to do this very thing;

    http://devblog.glype.com/
     
    peaforabrain, Jan 20, 2007 IP
  5. fuser

    fuser Peon

    Messages:
    541
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Good Blog man - very useful

    Question is which is better the rewrite or the 'real' subdomain creation
    ?
     
    fuser, Jan 20, 2007 IP
  6. peaforabrain

    peaforabrain Active Member

    Messages:
    45
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    63
    #6
    These are two different things.

    A subdomain that you make on your website, would typically hold all files related to a particular subject or script.

    Mod rewrite takes variable string url's and makes them look like suddirectories, they could in reality be from any where on your website.
     
    peaforabrain, Jan 20, 2007 IP
  7. FlyByNight

    FlyByNight Peon

    Messages:
    42
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    I asked my hosting if they can change the DNS and they said no, is there anyother work around?
     
    FlyByNight, Jan 20, 2007 IP
  8. fuser

    fuser Peon

    Messages:
    541
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #8
    FlyByNight most companies allow change of the DNS. What company are you using?

    peaforabrain: Got some issues trying to get whats on the blog to work for me. I don't know if you are the owner of it, but here are the things I encountered.

    1- I changing the DNS on my server and added the *.domain.com and directly after doing that I was able to get subdomain.domain.com to forward to domain.com - (didnt need to do the ServerAlias thing).

    2- There was not virtual hosts part in my httpd.conf file located in /etc/httpd/conf/httpd.conf - so instead I located the conf file in the /var/www/vhosts/domain.com/conf directory - there I found a virtual host part and the stuff in it. Added what was necessary

    3- As soon as I added the .htaccess file I started getting internal server error. Tried changing some stuff but that didnt work too. So still no soluion.


    I think this majorly has to do with me using plesk. You've seen this before?
     
    fuser, Jan 20, 2007 IP
  9. masoko2

    masoko2 Peon

    Messages:
    166
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Plesk have a script for creating subdomains (I am looking for this script at the mement - when I find it I'll post the info here). The problem is that this script should be executed with higher permissions that the regular php scripts - so you need to execute it with a cron job.
     
    masoko2, Oct 5, 2007 IP
  10. admin@suckered.us

    admin@suckered.us Banned

    Messages:
    670
    Likes Received:
    22
    Best Answers:
    0
    Trophy Points:
    0
    #10
    There are very few scripts.. Which is why we wrote ours from scratch. You may find you need to do that. Ours doesn't use directories..

    We wildcard DNS from our database.
     
    admin@suckered.us, Oct 5, 2007 IP
  11. chicagoweb

    chicagoweb Peon

    Messages:
    30
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #11
    Plesk has an API to do just that. Look at SWSoft Developer Network - http://swdn.swsoft.com/
     
    chicagoweb, Oct 5, 2007 IP