Ajay_Kumar
Ajay_Kumar

Reputation: 1387

subdomain redirection problem in php

I am creating subdomains dynamically through the php script. This is creating well. But when I try to open it I am getting a default cgi error page ( http://subdomain.mydomain.com/cgi-sys/defaultwebpage.cgi). But after 15-20 minutes later this is working fine. Why is this?

My subdomain creation code is below:

function subd($host, $port, $ownername, $passw, $request) {
    $authstr = "cpanel_userid:cpanel_password";

    $sock = fsockopen('localhost',2082);

    if(!$sock) {
        print('Socket error');
        exit();
    }

    $pass = base64_encode($authstr); 

    $in = "GET $request\r\n";
    $in .= "HTTP/1.0\r\n";
    $in .= "Host:localhost\r\n";
    $in .= "Authorization: Basic $pass\r\n";
    $in .= "\r\n";

    fputs($sock, $in);

    while (!feof($sock)) {
        $result .= fgets ($sock,128);
    }

    fclose( $sock );

    return $result;
}

I'm calling this function from my code. My subdomain is creating well but this is taking a bit more time to setup properly. Where am I going wrong? My server is running Linux.

Thanks.

Upvotes: 0

Views: 307

Answers (1)

Alp
Alp

Reputation: 29749

I presume that your web hoster needs the time to completely setup the subdomain. Looks normal to me.

Upvotes: 1

Related Questions