The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Can´t access subdomain, after creating it in cPanel with PHP

Discussion in 'General Discussion' started by nicop8, Apr 26, 2014.

  1. nicop8

    nicop8 Registered

    Joined:
    Apr 26, 2014
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    I have a website where the user create his own site, and for that i need to create a subdomain. My server has cPanel, so I´m creating the subdomain in cPanel using PHP code. The problem is that the subdomain is created correctly and the folder in the server too, but when i try to access it the server is not found. The subdomain doesn´t create in the DNS file zone by this way.

    I haven´t got the problem if I create the subdomain manually with the cPanel interface. In this case i can access to the subdomain. My hosting is Godaddy.

    I'm using the next php code:

    PHP:
    $pass base64_encode("$cpanel_user:$cpanel_pass");
    $in "GET /frontend/$cpanel_skin/subdomain/doadddomain.html?rootdomain=$cpanel_host&domain=$subdomain&dir=public_html/subdomains/$subdomain\r\n";
    $in .= "HTTP/1.0\r\n";
    $in .= "Host:$cpanel_host\r\n";
    $in .= "Authorization: Basic $pass\r\n";
    $in .= "\r\n";
    fputs($sock$in);
    while (!
    feof($sock)) {
    $result .= fgets ($sock,128);
     }
    fclose($sock);
    The code is working, because the subdomain appears in cPanel. But I can´t acces to it. Do you know what´s the problem? I haven´t got any problem in other servers, but i have this problem in godaddy.

    Thanks!
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello :)

    I recommend contacting your web hosting provider for assistance with this issue. It's possible they have custom security features in-place that prevent the successful creation of the subdomain through the cPanel API. Or, there could be a specific error message in the cPanel error log that they can investigate.

    Thank you.
     
Loading...

Share This Page