| | |
how create subdomain using php
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
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.
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.
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:
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.
PHP Syntax (Toggle Plain Text)
NameVirtualHost realdomain.com <VirtualHost realdomain.com> DocumentRoot "C:\My Sites\Site1" ServerName subdomain.realdomain.com </VirtualHost> <VirtualHost realdomain.com> DocumentRoot "C:\My Sites\Site2" ServerName realdomain.com </VirtualHost>
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
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
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.
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.
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.
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.
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.
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.
![]() |
Similar Threads
- create subdomain in server dynamically using php (PHP)
- how to create subdomain ? (VB.NET)
- WHM subdomains (Networking Hardware Configuration)
- Can php allow me to create whatever.homepage.com address (PHP)
Other Threads in the PHP Forum
- Previous Thread: Include problem
- Next Thread: Validate Selected Checkboxes
| Thread Tools | Search this Thread |
5.2.10 action address ajax apache api array auto autoincrement beginner binary broken cakephp checkbox class classes cms code cron curl database date dehasher destroy display domain dynamic echo email error errorlog fatalerror file files folder form forms function functions google href htaccess html if-else image include insert integration ip java javascript joomla limit link load login mail masterthesis menu mlm multiple mysql mysqlquery oop paypal pdf php popup problem query radio random record recursion regex remote script search security server sessions sms soap sockets source space sql syntax system table tutorial update upload url validator variable video web xml youtube






