简体   繁体   English

php中的子域重定向问题

[英]subdomain redirection problem in php

I am creating subdomains dynamically through the php script. 我正在通过php脚本动态创建子域。 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 ). 但是当我尝试打开它时,我得到一个默认的cgi错误页面( http://subdomain.mydomain.com/cgi-sys/defaultwebpage.cgi )。 But after 15-20 minutes later this is working fine. 但经过15-20分钟后,这个工作正常。 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. 我的服务器正在运行Linux。

Thanks. 谢谢。

I presume that your web hoster needs the time to completely setup the subdomain. 我认为您的Web主机需要时间来完全设置子域。 Looks normal to me. 看起来很正常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM