Why is an account of unlimited space and bandwidth being created, if I'm my package has limits?

desbest

Member
Jan 7, 2009
8
0
51
My php code uses this to create a cpanel account.
PHP:
$task2=$whm->createAccount('testdomain.com','testuser','changeme','testpassword123','hostingz_HL5');
The package has 500MB space and 1500MB bandwidth.
/http://imageshack.com/a/img6/5731/qgp4.png

But when I check my email or the account created in WHM, it says that the account has unlimited space and bandwidth.
/http://imagizer.imageshack.us/v2/800x600q90/43/r6m8.png

How can I stop this unlimited space and bandwidth giving, and have WHM respect the package's limits when creating an account?
 
Last edited:

KostonConsulting

Well-Known Member
Verifed Vendor
Jun 17, 2010
255
1
68
San Francisco, CA
cPanel Access Level
Root Administrator
In that account creation email, the package is HL5 not hostingz_FH5. If you've copied and pasted the php code, you are missing a closing single quote after the package name.

It's not clear how you are calling the API as I'm not familiar with the $whm object you are using but you may want to follow the createacct example in the Examples for cPanel's PHP API class: https://github.com/CpanelInc/xmlapi-php
 

desbest

Member
Jan 7, 2009
8
0
51
I've updated the post to get rid of the php error and update the image.
I'd prefer not to use Cpanel's php api class, because when creating an account, it doesn't allow the developer to choose the hosting package the person wants. https://github.com/CpanelInc/xmlapi-php/blob/master/xmlapi.php#L944

I'm using Cpanel's 2004 accounting.php.inc for my script in other places, but as createacct doesn't work in accounting.php.inc, I'm using whm.php from Php Classes in this instance.
 
Last edited:

KostonConsulting

Well-Known Member
Verifed Vendor
Jun 17, 2010
255
1
68
San Francisco, CA
cPanel Access Level
Root Administrator
I've updated the post to get rid of the php error and update the image.
I'd prefer not to use Cpanel's php api class, because when creating an account, it doesn't allow the developer to choose the hosting package the person wants. https://github.com/CpanelInc/xmlapi-php/blob/master/xmlapi.php#L944

I'm using Cpanel's 2004 accounting.php.inc for my script in other places, but as createacct doesn't work in accounting.php.inc, I'm using whm.php from Php Classes in this instance.
Please post the source of $whm->createAccount(). That appears to be a custom function you wrote so without us seeing the code, we have no idea what it does or why it's going wrong.

Thanks!
 

MesinHosting

Member
Mar 25, 2011
13
0
51
from what i know. cpanel api
(/https://github.com/CpanelInc/xmlapi-php/blob/master/xmlapi.php)

can be use to create and modify such as change package cpanel account as well. and, from what we have know, php was run very fast. so i think, based on that opinion, call the createacct can be run first, and after that you can update for the package.

modify an account can be done based on changepackage function
(/https://github.com/CpanelInc/xmlapi-php/blob/master/xmlapi.php#L1203)

create account can be done based on function createacct
(/https://github.com/CpanelInc/xmlapi-php/blob/master/xmlapi.php#L956)

this will i do, if i were in your position

PHP:
include_once ('xmlapi.php');
$call = new xmlapi($ip);
$call -> password_auth('root',$yourpassword);
$call -> set_debug(1);
$account = array(username => 'theusername',password => 'thepassword',domain => 'thedomain.tld');
$call -> createacct($account);
$call -> changepackage('theusername','package_name');
hope that's help
 

desbest

Member
Jan 7, 2009
8
0
51
Thanks for the code sample. I'll try the code sample if the whm.php class file cannot be used.
I never thought about using code to change the package, after the account is created.

Here's the whm.php file code I was using.
The problem is that even when I specify the package to use when creating the hosting account, it creates an unlimited account instead of respecting the package I chose to use.
 

cPanelKenneth

cPanel Development
Staff member
Apr 7, 2006
4,607
80
458
cPanel Access Level
Root Administrator
I'd prefer not to use Cpanel's php api class, because when creating an account, it doesn't allow the developer to choose the hosting package the person wants. https://github.com/CpanelInc/xmlapi-php/blob/master/xmlapi.php#L944
Our API class does let your specify a package during account creation. As the documentation you linked to states:
Any other key/value pairs as defined by the createaccount call documentation are allowed parameters for this call.
Documentation for createaccount is here: Create an Account — createacct

This means you can construct a function call like:

Code:
include_once ('xmlapi.php'); 
$call = new xmlapi($ip); 
$call -> password_auth('root',$yourpassword); 
$call -> set_debug(1); 
$account = array(username => 'theusername',password => 'thepassword',domain => 'thedomain.tld', 'plan' => 'my_plan'); 
$call -> createacct($account);
 

fabioliotta

Registered
Feb 23, 2014
3
0
1
cPanel Access Level
Root Administrator
i have the same problem, if i use 'quota'

example
$account = array(username => 'theusername', password => 'thepassword', domain => 'thedomain.tld', 'quota' => '3500');

doesn't working, if i check WHM i see unlimited as quota instead of 3500

How is possible fixing this problem ?

any help please?

thanks in advance