Can´t access subdomain, after creating it in cPanel with PHP
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);
[/PHP]
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!
-
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. 0
Please sign in to leave a comment.
Comments
1 comment