how create subdomain using php

Reply

Join Date: Apr 2008
Posts: 75
Reputation: danishbacker is an unknown quantity at this point 
Solved Threads: 5
danishbacker's Avatar
danishbacker danishbacker is offline Offline
Junior Poster in Training

how create subdomain using php

 
0
  #1
Oct 21st, 2008
how can i create a subdomain using php?

Thanks in advance
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 524
Reputation: Will Gresham is on a distinguished road 
Solved Threads: 86
Sponsor
Will Gresham's Avatar
Will Gresham Will Gresham is offline Offline
Posting Pro

Re: how create subdomain using php

 
0
  #2
Oct 21st, 2008
You can't, Sub-Domains are managed by the web server. Speak to your host for information on how to set one up.
AJAX is not a programming language, scripting language or any other sort of language.
It is acheived by using JavaScript http functions.
So, AJAX = JavaScript.
Reply With Quote Quick reply to this message  
Join Date: Apr 2008
Posts: 75
Reputation: danishbacker is an unknown quantity at this point 
Solved Threads: 5
danishbacker's Avatar
danishbacker danishbacker is offline Offline
Junior Poster in Training

Re: how create subdomain using php

 
0
  #3
Oct 22nd, 2008
I'm a beginner,
I mean is there any way to create a subdomains like some free hosting sites do?
Is there any other way to make subdomain creation upon user request.
I used create sub domains from my control panel.
i don't know what actually CGI is, is it possible with that? or ruby or perl?

Forgive me if my question is a blunder .
Thanks a lot for your reply.
Reply With Quote Quick reply to this message  
Join Date: Apr 2005
Posts: 16,207
Reputation: jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all 
Solved Threads: 538
Moderator
Featured Poster
jbennet's Avatar
jbennet jbennet is offline Offline
Moderator

Re: how create subdomain using php

 
0
  #4
Oct 22nd, 2008
unix-like or windows server?
If i am helpful, please give me reputation points.
Reply With Quote Quick reply to this message  
Join Date: Apr 2008
Posts: 75
Reputation: danishbacker is an unknown quantity at this point 
Solved Threads: 5
danishbacker's Avatar
danishbacker danishbacker is offline Offline
Junior Poster in Training

Re: how create subdomain using php

 
0
  #5
Oct 23rd, 2008
unix-like server
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 1,476
Reputation: cwarn23 has a spectacular aura about cwarn23 has a spectacular aura about cwarn23 has a spectacular aura about 
Solved Threads: 136
cwarn23's Avatar
cwarn23 cwarn23 is offline Offline
Nearly a Posting Virtuoso

Re: how create subdomain using php

 
0
  #6
Oct 23rd, 2008
The only way that I know how to make subdomains (other than using the servers control panel) is by editing the apache httpd.conf file which you may be able to program a php script to do if you have full permissions of the server. Guides can be found at http://apptools.com/phptools/virtualhost.php So if you are the server administrator then just program a php script to edit the httpd.conf file as instructed in the above and the apache codes would look something like:
  1. NameVirtualHost realdomain.com
  2.  
  3. <VirtualHost realdomain.com>
  4. DocumentRoot "C:\My Sites\Site1"
  5. ServerName subdomain.realdomain.com
  6. </VirtualHost>
  7.  
  8. <VirtualHost realdomain.com>
  9. DocumentRoot "C:\My Sites\Site2"
  10. ServerName realdomain.com
  11. </VirtualHost>
And obviously replace in the code above the term "realdomain.com" with your registered domain and replace the word "subdomain" with the name of your subdomain. But that is a sketch of what I think the apachie code needs to look like but would wait for further comments on the above code before copying it.

Also in the link I provided, you will need to ignore the information below the title: "Resolving the DNS issue" as you have a domain in the first place instead of localhost.

So basically, the only thing that php can really do is edit the apache httpd.conf file.
Try not to bump 10 year old threads as it can be really annoying.
Like php then read my website at http://syntax.cwarn23.net/
Star-Trek-Atlantis - now that's what I call a movie ^_^
My favourite PC. - MacGyver Fan
Bad english note: dis-iz-2b4u
Reply With Quote Quick reply to this message  
Join Date: Apr 2008
Posts: 75
Reputation: danishbacker is an unknown quantity at this point 
Solved Threads: 5
danishbacker's Avatar
danishbacker danishbacker is offline Offline
Junior Poster in Training

Re: how create subdomain using php

 
0
  #7
Oct 23rd, 2008
Thanks a lot,
can you please tell me where to place the httpd.conf
or
i'll have to place http.conf with contents as above in my root folder?

i'm attaching directory structure of my domain.

Thanks.
Last edited by danishbacker; Oct 23rd, 2008 at 8:14 am.
Attached Thumbnails
dir.gif  
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 87
Reputation: TopDogger is an unknown quantity at this point 
Solved Threads: 5
TopDogger's Avatar
TopDogger TopDogger is offline Offline
Junior Poster in Training

Re: how create subdomain using php

 
0
  #8
Oct 23rd, 2008
You need server root access in order to manually modify the httpd.conf file. Very few hosting companies will give a site owner root access. Using cPanel to add a subdomain does the same thing.

Unless you are very familiar with Linux/Unix servers, you should not be doing anything at the server root level.

I think what you really want to do is to set up a widcard DNS that allows you to artificially create sub domains. I have used this article to do that. The article also shows you how to manually edit the httpd.conf file.

Wildcard DNS

Another option would be to create subdirectories for your users with PHP. That is easier to do.
Reply With Quote Quick reply to this message  
Join Date: Apr 2008
Posts: 75
Reputation: danishbacker is an unknown quantity at this point 
Solved Threads: 5
danishbacker's Avatar
danishbacker danishbacker is offline Offline
Junior Poster in Training

Re: how create subdomain using php

 
0
  #9
Oct 23rd, 2008
Thanks for your reply, I don't have the login details for my DNS ("Edit DNS Zone") configuration
I only have username and password for my cpanel. Then it seems to be a difficlut job for me. Also i didn't get you completely (wildcard DNS).

also I think I have to switch to the second methid you've suggested.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC