Click to See Complete Forum and Search --> : park domains using PHP


niroshan
08-07-2007, 03:12 AM
Hi everyone,

I need to find out a way to park domains using PHP. I can park domains using my cpanel but what i needed to do is to create a script using PHP which will do that automatically. Only thing i accept from user is the domain name they want to park and thats it. the rest i want to handle through my program.

I have done some research and found out that all the park domain entries goto one file (httpd.conf)

My first question is can i do this using php? Is there any other way instead of writing the httpd.conf file? I dont want to mess with httpd.conf file since it contains all the configurations :o


If someone can point me to right direction i`ll be really appreciate it.

Thanks in advance,

Regards,
Niroshan

cahva
08-07-2007, 07:01 AM
You dont have to add the domains to httpd.conf file. When you set dns to point to the server, Apache will direct the page to server's default page if the domain is not added to the httpd.conf.

You can use PHP to show what domain is parked. Modify the servers default page using this little script:


<?php
if (!empty($_SERVER['HTTP_REFERER'])) {
$refe = $_SERVER['HTTP_REFERER'];
} else {
$refe = $_SERVER["HTTP_HOST"];
}

echo "Domain {$refe} is parked here.";
?>


Not the most sophisticated one but will do the job.

Oh, you dont have to use the servers default page if you dont want to. Add IP to httpd.conf that will handle all the domainpark domains and then when you add DNS to some domainpark domain, point it to that ip.

niroshan
08-07-2007, 07:10 AM
Hi cahva,

Thank you very much for your valuable reply. Really appreciate it. I have one other question,

If i didn`t edit the 'httpd.conf' file to add the park domains what will be the result when i`m checking everthing next time from cpanel.

Im not sure but i think cpanel reading this file and show us the list of parked domains right?

if this is the case is there any work around for this?

thank,
Niroshan

cahva
08-07-2007, 08:13 AM
I havent used cpanel so I dont know how that works, sorry :(