HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   General (http://www.howtoforge.com/forums/forumdisplay.php?f=25)
-   -   Problem creating a web domain using the remote api (http://www.howtoforge.com/forums/showthread.php?t=60562)

NewRehtse 14th February 2013 14:42

Problem creating a web domain using the remote api
 
Hello everybody!

I am doing a wizard to create sites and ftp users and I am having issues with the creation of the web domain.

I create using the ispconfig3 functions a client (client_add), a web_domain (sites_web_domain_add) and a ftp user (sites_ftp_user_add) and all of them are listed on the ISPConfig Panel administration.

The problem is that the web domain doesn't work until I go to the panel edit and save it again (without change anything), I think that is something I am not configuring ok on the params or maybe there is another function resync or refresh that I should call.

The params are:

PHP Code:

$default_website_params = array(
        
'ip_address' => '',
        
'domain' => $domain,
        
'type' => 'vhost',
        
'parent_domain_id' => 0,
        
'vhost_type' => 'name',
        
'hd_quota' => 100,
        
'traffic_quota' => 4000,
        
'cgi' => 'n',
        
'ssi' => 'n',
        
'suexec' => 'n',
        
'errordocs' => 1,
        
'is_subdomainwww' => 1,
        
'subdomain' => 'none',
        
'php' => 'mod',
        
'ruby' => 'n',
        
'redirect_type' => '',
        
'redirect_path' => '',
        
'ssl' => 'n',
        
'ssl_state' => '',
        
'ssl_locality' => '',
        
'ssl_organisation' => '',
        
'ssl_organisation_unit' => '',
        
'ssl_country' => 'ES',
         
'ssl_domain' => $domain,
        
'ssl_request' => '',
        
'ssl_cert' => '',
        
'ssl_bundle' => '',
        
'ssl_action' => '',
        
'stats_password' => '',
        
'stats_type' => 'webalizer',
        
'allow_override' => 'All',
        
'apache_directives' => '<Directory /var/www/comunes>'.chr(13).' Order allow,deny'.chr(13).' Allow from all'.chr(13).' </Directory> ',
//         'php_open_basedir' => '/var/www/comunes',
        
'custom_php_ini' => '',
        
'backup_interval' => 'none',
        
'backup_copies' => 1,
        
'active' => 'y',
        
'traffic_quota_lock' => 'n'
); 

In this way, the web domain is on the ispconfig panel and if i open it and save it works... but it is not what i want.

Other thing I have tried is to set the ip_address to * because it is an * in other domain I have but then I get the error: Error 101 (net::ERR_CONNECTION_RESET).

The code I use to create the web domain is in a function of a class i did:

PHP Code:

public function addWebSite($clientid$params) {
            
$params['server_id'] = $this->server_id;
            
utf8_encode_array($params,'utf8_decode_array');
            try {
                return 
$this->soapClient->sites_web_domain_add($this->session_id$clientid$params$readonly false);
            }  catch (
SoapFault $e) {
                throw new 
IspcfgException($e->getMessage(), 500);
            } catch (
Exception $e) {
                throw new 
IspcfgException($e->getMessage(), 500);
            }
        } 

Thank you very much in advance!

till 14th February 2013 15:11

Quote:

I think that is something I am not configuring ok on the params
Thats the most likely reason. There is no other function that has to be called.

To find out which parameters you might have missed, create a website in the ispconfig and then create a website with the api and compare the settings of both records in the database.

NewRehtse 14th February 2013 15:44

The main difference is the * in ip_address but it gives me error 101, and this error appears only with i put the * ? I dont understand why, it is a 101 error!

NewRehtse 14th February 2013 19:42

It is solved, at the end it was other unrelated problem but i still don't know why it worked when the ip_address parameter was empty and with the '*' doesn't....

The problem was that the same script creates the ispconfig user, web domain and ftp user and after that it uploads all the data to the new web site but because it was so quickly the ftp upload fails because there wasn't enough time... so I put a sleep(15) between the ispconfig creation and the ftp upload stuff... and the sleep was causing the 101 error.

till 15th February 2013 09:17

ISPConfig is working asyncroniously, the ispconfig server part is checking every 60 seconnds if there were changes made trough the interface (or api). So if you want to upload data to a ftp user created with the api, wait at least 60 seconds.


All times are GMT +2. The time now is 06:13.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.