New ISPConfig module for WHMCS

Discussion in 'Tips/Tricks/Mods' started by cwispy, Dec 11, 2014.

Thread Status:
Not open for further replies.
  1. cwispy

    cwispy Active Member

    Yes I am running the latest version or WHMCS 6.1.1. I had to adjust my php.ini files with the following to get around all the errors in whmcs.

    error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_WARNING

    I had some issues when I first upgraded as well. If you have any other self written scripts, check your web servers error log for messages about errors in those files. I had to adjust a number of classes that I had written in some other modules I use locally.
    cwispy
     
  2. Entangled

    Entangled Member

    Hello.

    How do I populate the WHMCS database with the server info that this module would have added?

    I have Clients in WHMCS that were added manually to ISPConfig.

    Thank you.
     
  3. cwispy

    cwispy Active Member

    Hi Entangled,

    This module does not keep anything in WHMCS. It matches the username from the WHMCS product with the user in ISPConfig. However it creates one username per product. So if a client has more than one product, they will have more than one username with the way this module works.
     
  4. Entangled

    Entangled Member

    crispy,

    Thanks for the reply.

    OK, so how do I match the two up? A Client is in WHMCS with a Product and the same Client is in ISPConfig which was manually added.

    Thanks again,

    Craig (a.k.a Entangled).
     
  5. webguyz

    webguyz Active Member HowtoForge Supporter

    Create ISPConfig Products in WHMCS that reflect your setup on ISPConfig. Manually add the ISPConfig product to the WHMCS user and then add the login/password from ISPconfig to the username and password fields in WHMCS for that product. Set your pricing etc.

    Do not press the create button.
     
  6. boldbesusiax

    boldbesusiax New Member

    Howdy!

    This module is great stuff, big thank you to cwispy and everybody who has contributed to it.

    I have this module about 80% functional but I have hit a few snags. I am running ISPConfig 3.0.5.4p8, WHMCS 6.1.1 and the latest version of ispcfg3. The servers are running Apache on Debian 8.

    I am able to suspend plus terminate accounts but when I run the create an account in WHMCS it creates the user in ISPConfig, sets up their domain with all the proper records from the template but then it gives me the error "SOAP Error: Internal Server Error" and doesn't create an email server or webserver. I cant find any errors in Apache or WHMCS unless I am looking in all the wrong spots.

    I can only partially create users, does anybody know how to fix this?
     
  7. webguyz

    webguyz Active Member HowtoForge Supporter

    Are you using multiserver or standalone ISPConfig. If Multiserver does the spelling of the web and mail servers in the WHMCS Server Groups setup match exactly the FQDN of your ispconfig servers?
     
  8. boldbesusiax

    boldbesusiax New Member

    Its a kinda multi-server setup. I have one server that runs exclusively ISPConfig Control Panel (doesn't act as a webserver for clients just the access to the CP) then I have a second server that runs all the services on one box.

    I just double checked the spelling for the server in the WHMCS Server Groups, which is the slave server that runs all the services. In my products I have ispcfg3 point to the actual ISPConfig control panel server and it seems to authenticate just fine and it has even suspended my test user fine but the create function seems to die during or just after creating the users domain.
     
  9. cwispy

    cwispy Active Member

    If you have not done so yet, enable module logging under Utilities, Logs. Module Logs. Then run a task and go back to the module log and see what it says. Be sure to disable the logging again on a production system.
     
  10. boldbesusiax

    boldbesusiax New Member

    Hi cwispy,

    As per your instructions I enabled debugging, ran the create function and then disabled it after the internal server error. Here are some of the results I got:

    For the Internal Server Error (the last entry in the log), here was the Response:
    Code:
    Array
    (
        [whmcsVersion] => 6.1.1-release.1
        [accountid] => 1
        [serviceid] => 1
        [userid] => 1
        [domain] => example.com
        [username] => examplec
        [password] => [REDACTED]
        [packageid] => 2
        [pid] => 2
        [serverid] => 3
        [status] => Pending
        [type] => hostingaccount
        [producttype] => hostingaccount
        [moduletype] => ispcfg3
        [configoption1] => [REDACTED]
        [configoption2] => [REDACTED]
        [configoption3] => ispconfig.pawlakconsulting.net:8080
        [configoption4] => on
        [configoption5] => 1
        [configoption6] => default
        [configoption7] => no,fast-cgi,php-fpm
        [configoption8] => no
        [configoption9] => on
        [configoption10] =>
        [configoption11] =>
        [configoption12] => 2048
        [configoption13] => 102400
        [configoption14] => n,n,n,y,n,y
        [configoption15] => www
        [configoption16] => php-fpm
        [configoption17] => on
        [configoption18] => on
        [configoption19] => ns0.pawlakconsulting.net,ns1.pawlakconsulting.net,webmaster,1,96.93.96.189
        [configoption20] => en
        [configoption21] => on
        [configoption22] => on
        [configoption23] =>
        [configoption24] =>
        [customfields] => Array
            (
            )
    
        [configoptions] => Array
            (
            )
    
        [clientsdetails] => Array
            (
                [userid] => 1
                [id] => 1
                [firstname] => Test
                [lastname] => Man
                [fullname] => Test Man
                [companyname] =>
                [email] => [REDACTED]
                [address1] => 123 Test Ln
                [address2] =>
                [city] => Testville
                [fullstate] => Testopia
                [state] => WA
                [postcode] => 98501
                [countrycode] => US
                [country] => US
                [phonenumber] => 4256542690
                [password] => [REDACTED]
                [statecode] => WA
                [countryname] => United States
                [phonecc] => 1
                [phonenumberformatted] => +1.4256542690
                [billingcid] => 0
                [notes] => Test account - DELETE ME
                [twofaenabled] =>
                [currency] => 1
                [defaultgateway] => paypal
                [cctype] =>
                [cclastfour] =>
                [securityqid] => 1
                [securityqans] => [REDACTED]
                [groupid] => 0
                [status] => Inactive
                [credit] => 0.00
                [taxexempt] =>
                [latefeeoveride] =>
                [overideduenotices] =>
                [separateinvoices] =>
                [disableautocc] =>
                [emailoptout] =>
                [overrideautoclose] =>
                [language] =>
                [lastlogin] => No Login Logged
            )
    
        [server] => 1
        [serverip] => 10.0.0.101
        [serverhostname] => www0.pawlakconsulting.net
        [serverusername] =>
        [serverpassword] =>
        [serveraccesshash] =>
        [serversecure] =>
        [serverhttpprefix] => http
        [serverport] =>
        [action] => create
    )
    
    I've attached a screenshot of the steps leading up to the last log (figured it would easier to have you see the steps than create a long drawn out post, I hope it is not in poor form/etiquette)
     

    Attached Files:

  11. radim_h

    radim_h Member HowtoForge Supporter

    Just for info, in previous post, ive got the module working with 6.1.1, and it ws on Debian7.
    Later, I have reinstalled my devel server to Debian8, have exactly same setting for module /i imported sql database from WHMCS/ also have same directory with WHMCS instalaltion, target server with WHMCS stayed untouched. But now i cannot get it working.

    With module command CREATE im getting error Module Command Error
    SOAP Error: Could not connect to host
    in module log, there is simple "Could not connect to host" i can ping and telnet host from whmcs server.
    ---
    Is there any way how i could test connect to ISPConfig API ? I feel desperate, lost about two working days allready ???

    and question 2 - has something to be filled here http://mixx.org/tmp/server-details.png ? on my previous install there was login into ISPConfig, but i§m not sure it made sense
     
  12. till

    till Super Moderator Staff Member ISPConfig Developer

  13. radim_h

    radim_h Member HowtoForge Supporter

    Hello,

    thank you for info. Stil have no luck, i suppose
    cp /usr/local/ispconfig/interface/ssl/ispserver.crt /usr/local/share/ca-certificates/
    update-ca-certificates
    openssl.cafile=/etc/ssl/certs/ca-certificates.crt into nano /etc/php5/apache2/php.ini
    service apache2 restart
    has to be done on ISPConfig side. Do i have to change something on WHMCS side ?

    IS there any way how to test SOAP?
     
  14. radim_h

    radim_h Member HowtoForge Supporter

    SOLVED. I've go it working now, in multiserver setup.
    So the problem was really in SSL & PHP 5.6. Even if you update-ca-certificates the certificate for target server must match name of the server. (i was using testing server with generic certifikcate)
    Haven't found any tutorial how to disable server name check which can be useful in some cases...
     
    Last edited: Dec 1, 2015
  15. concept21

    concept21 Active Member

    I encounter this error in my apache log when I configure this module.
    My system is WHMCS 6.1.1, Ubuntu 14.04, php 5.5.9.
    Any body knows how to correct this? :(
    =========================

    ispconfig3[3021]: PHP Warning: Invalid argument supplied for foreach() in /var/www/clients/client1/web1/web/path-to-whmcs-admin/configproducts.php on line 0

    ispconfig3[3021]: PHP Warning: is_file(): open_basedir restriction in effect. File(/var/www/clients/client1/web1/web/path-to-whmcs/modules/servers/index.php/index.php.php) is not within the allowed path(s): (/var/www/clients/client1/web1/web:/var/www/clients/client1/web1/tmp:/var/www/domain/web:/srv/www/domain/web:/usr/share/php5:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin) in /var/www/clients/client1/web1/web/path-to-whmcs/includes/classes/WHMCS/Module/AbstractModule.php on line 0
     
  16. concept21

    concept21 Active Member

    May we raise a Fund for developing this module? :)
    I suggest we post this job on Upwork for US$80.00. If 10 guys join, each of us only pay US$8 only. It can still be published as GPL.

    Reply here to confirm. :)
     
  17. radim_h

    radim_h Member HowtoForge Supporter

  18. webguyz

    webguyz Active Member HowtoForge Supporter

  19. radim_h

    radim_h Member HowtoForge Supporter

    Thank you for info, will try it, bit complicated for me to incorporate it into ispcfg3.php .]

    ------------------------------------------

    I have one more question. I'm tryin to create db user and database autoamatically with something like the script bellow.
    I just do not know how to get 'database_user_id' from SOAP, cannot find in SOAP docs .
    Will SOAP tell me this what is database_user_id for created database user, without direct database query as:
    USE dbispconfig;
    SELECT database_user_id FROM `web_database_user` WHERE `database_user` = ($username . 'u1'')

    ?



    if ( $adddbmysql == 'on' ) {

    $domain_arr = $client->sites_database_user_add( $session_id, $website_id );
    $ispcparams = array(
    'server_id' => $defaultdbserver,
    'database_user' => $username . 'u1',
    'database_password' => $password
    );

    $database_id = $client->sites_database_user_add($session_id, $client_id, $ispcparams);
    logModuleCall('ispconfig','CreateDbUser',$ftp_id,$ispcparams,'','');

    $domain_arr = $client->sites_database_add( $session_id, $website_id );
    $ispcparams = array(
    'server_id' => $defaultdbserver,
    'parent_domain_id' => $website_id,
    'type' => 'mysql',
    'database_name' => $username . 'db1',
    'database_user_id' => 'HOW TO GET THIS ONE ???? ',
    'database_ro_user_id' => '0',
    'database_charset' => 'UTF8',
    'remote_access' => 'n',
    'remote_ips' => '',
    'backup_interval' => 'none',
    'backup_copies' => 0,
    'active' => 'y'
    );

    $database_id = $client->sites_database_add($session_id, $client_id, $ispcparams);

    logModuleCall('ispconfig','CreateDbMySQL',$ftp_id,$ispcparams,'','');
    }
     
    Last edited: Dec 4, 2015
  20. cwispy

    cwispy Active Member

    According to the API Docs, for the sites_database_user_add() it returns the ID of the new user. So you would use the returned value as the user ID.
     
Thread Status:
Not open for further replies.

Share This Page