Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

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 Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,802
    Likes Received:
    1,895
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    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.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice