Directory not creating/also subdomains

gillz

Member
May 31, 2008
5
0
51
have vps server with whm cpanel and for my sites also cpanel i have issue i cant make folder/dir with php code
mkdir('mydir', 0777); like this and also cant make subdoamins with coding i have script there people can make therir own wap sites and i use this coding
$name=$_POST['name'];
mkdir (strtolower("$name"));
@ chmod(strtolower("$name",0755));
mkdir(strtolower("$name/files"));
@ chmod(strtolower("$name/files",0755));
mkdir(strtolower("$name/pics"));
@ chmod(strtolower("$name/pics",0755));

and for make their subdoamin i use



$cpanel_user = "username";
$cpanel_password = "password";
$cpanel_host = "mysite.com";


file("http://.$cpanel_user.":".$cpanel_password."@".$cpanel_host:2082/frontend/x2/subdomain/doadddomain.html?domain=$name&rootdomain=mysite.com'");

and it was worked at my normal site but now at vps it wont work users data dum in data base but there no folder /dir make like if user name is test it should be http://test.mysite.com

but nor subdoamin and others folder creat in user dir/folder

is it shell_exec issue if yes then how can i solve it ?

hope you understand my issue and help me thanks
 

cPanelNick

Administrator
Staff member
Mar 9, 2015
3,481
35
208
cPanel Access Level
DataCenter Provider
have vps server with whm cpanel and for my sites also cpanel i have issue i cant make folder/dir with php code
mkdir('mydir', 0777); like this and also cant make subdoamins with coding i have script there people can make therir own wap sites and i use this coding
$name=$_POST['name'];
mkdir (strtolower("$name"));
@ chmod(strtolower("$name",0755));
mkdir(strtolower("$name/files"));
@ chmod(strtolower("$name/files",0755));
mkdir(strtolower("$name/pics"));
@ chmod(strtolower("$name/pics",0755));

and for make their subdoamin i use



$cpanel_user = "username";
$cpanel_password = "password";
$cpanel_host = "mysite.com";


file("http://.$cpanel_user.":".$cpanel_password."@".$cpanel_host:2082/frontend/x2/subdomain/doadddomain.html?domain=$name&rootdomain=mysite.com'");

and it was worked at my normal site but now at vps it wont work users data dum in data base but there no folder /dir make like if user name is test it should be http://test.mysite.com

but nor subdoamin and others folder creat in user dir/folder

is it shell_exec issue if yes then how can i solve it ?

hope you understand my issue and help me thanks
You really should use the xml api for this

http://www.cpanel.net/plugins/xmlapi/cpanel.html


file("http://.$cpanel_user.":".$cpanel_password."@".$cpanel_hos t:2082/xml-api/cpanel?cpanel_xmlapi_module=SubDomain&cpanel_xmlapi_func=addsubdomain&cpanel_xmlapi_apiversion=1&domain=$name&rootdomain=mysite.com'");
 

gillz

Member
May 31, 2008
5
0
51
You really should use the xml api for this

http://www.cpanel.net/plugins/xmlapi/cpanel.html


file("http://.$cpanel_user.":".$cpanel_password."@".$cpanel_hos t:2082/xml-api/cpanel?cpanel_xmlapi_module=SubDomain&cpanel_xmlapi_func=addsubdomain&cpanel_xmlapi_apiversion=1&domain=$name&rootdomain=mysite.com'");
here i get error
SubDomainaddsubdomaineventinternal1Error from domain wrapper: .mysire.com could not be modified because it does not resolve to a valid IP address. Please ask the system admin to check their resolv.conf and their dns trust relationship Ignore any messages of success this can only result in failure!

i just changed after
2082:xml-api/cpanel?cpanel_xmlapi_module=SubDomain&cpanel_xmlapi_func=addsubdomain&cpanel_xmlapi_apiversion=1&domain=$name&rootdomain=mysite.com'");


is there wrong somthing?
 

gillz

Member
May 31, 2008
5
0
51
i have solved issue abt mk dir with php.ini
also very very thanks of Dave Lanning
Technical Analyst 1 and Ken Folse who provide me good support as i never thought and you all guys now only subdomain issue is still

very nice support
 
Last edited:

gillz

Member
May 31, 2008
5
0
51
You really should use the xml api for this

http://www.cpanel.net/plugins/xmlapi/cpanel.html


file("http://.$cpanel_user.":".$cpanel_password."@".$cpanel_hos t:2082/xml-api/cpanel?cpanel_xmlapi_module=SubDomain&cpanel_xmlapi_func=addsubdomain&cpanel_xmlapi_apiversion=1&domain=$name&rootdomain=mysite.com'");
hello, there are no any plugin for make subdomain can you help me please?