HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Developers' Forum (http://www.howtoforge.com/forums/forumdisplay.php?f=33)
-   -   ISPConfig 3.0.3.3 Bug or feature :-) (http://www.howtoforge.com/forums/showthread.php?t=54631)

dgmufasa 24th October 2011 19:11

ISPConfig 3.0.3.3 Bug or feature :-)
 
Hello all,

I am using the ISPConfig API (with PHP). I was able to run it pretty well until I had hit this issue.

I am getting the following error when trying to add web domain to the system: session_does_not_existThe Session is expired or does not exist.

Below are the code and inputs.

Does anyone out there know why this is taking place or what one can do to troubleshoot it further?

TIA


The output

Logged successfull. Session ID:b375a638d8c5bc20baee88750c6711a1

Session ID set is: b375a638d8c5bc20baee88750c6711a1

The items passed in
Array ( [server_id] => 1 [ip_address] => * [domain] => foofoo.com [type] => vhost [parent_domain_id] => 0 [vhost_type] => name [document_root] => /var/www/clients/client41/web123 [system_user] => web123 [system_group] => client41 [hd_quota] => 100000 [traffic_quota] => -1 [cgi] => y [ssi] => y [suexec] => y [errordocs] => 1 [is_subdomainwww] => 1 [subdomain] => www [php] => fast-cgi [ruby] => n [redirect_type] => [redirect_path] => [ssl] => n [ssl_state] => [ssl_locality] => [ssl_organisation] => [ssl_organisation_unit] => [ssl_country] => [ssl_domain] => [ssl_request] => [ssl_cert] => [ssl_bundle] => [ssl_action] => [stats_password] => [stats_type] => webalizer [allow_override] => All [apache_directives] => [php_open_basedir] => /var/www/clients/client41/web123/web:/var/www/clients/client41/web123/tmp:/var/www/stashandcarry.com/web:/srv/www/stashandcarry.com/web:/usr/share/php5:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin [custom_php_ini] => [backup_interval] => none [backup_copies] => 1 [active] => y [traffic_quota_lock] => n )


PHP Code:

    public function __siteaddwebdomain$inrecserverid$inrecclientid$indomainid$inwebsiteid
    
$inlinuxuser$webrootdir$injoomlaid$indomname ){
        try {
            
$affected_rows = -999999;
            
            if  ( !( 
$inrecclientid and $inrecclientid 9999 ) ) {
                die(
"=> ERROR: Invalid client id: $inrecclientid was passed into function. Check the system");
            }
            
            
$wlinuxgroup     "client" $inrecclientid;            
            
$wlinuxuser      "web" $injoomlaid;
            
$wsetroot         $webrootdir "/" $wlinuxgroup "/" $wlinuxuser;
            
            
            echo 
"=> Linux Group: $wlinuxgroup  Linux User: $wlinuxuser will be created <br />";
            
            if(
$session_id $this -> ispclient->login($this -> ispcusername,
            
$this -> ispcpassword)) {
                echo 
'<br />Logged successfull. Session ID:'.$session_id.'<br />';
            }

            
$params = array(
            
'server_id'         => $inrecserverid,
            
'ip_address'         => '*',
            
'domain'             => $indomname,
            
'type'                 => 'vhost',
        
    
'parent_domain_id'     => 0,
            
'vhost_type'         => 'name',
            
'document_root'     => $wsetroot,
            
'system_user'         => $wlinuxuser,
        
    
'system_group'         => $wlinuxgroup,
            
'hd_quota'             => 100000,
            
'traffic_quota'     => -1,
            
'cgi'                 => 'y',
            
'ssi'                 => 'y',
            
'suexec'             => 'y',
            
'errordocs'         => 1,
            
'is_subdomainwww'     => 1,
            
'subdomain'         => 'www',
            
'php'                 => 'fast-cgi',
            
'ruby'                 => 'n',
            
'redirect_type'     => '',
            
'redirect_path'     => '',
            
'ssl'                 => 'n',
            
'ssl_state'         => '',
            
'ssl_locality'         => '',
            
'ssl_organisation'         => '',
            
'ssl_organisation_unit' => '',
            
'ssl_country'         => '',
            
'ssl_domain'         => '',
            
'ssl_request'         => '',
            
'ssl_cert'             => '',
            
'ssl_bundle'         => '',
            
'ssl_action'         => '',
            
'stats_password'     => '',
            
'stats_type'         => 'webalizer',
            
'allow_override'     => 'All',
            
'apache_directives' => '',
            
'php_open_basedir'     => "/var/www/clients/$wlinuxgroup/$wlinuxuser/web:/var/www/clients/$wlinuxgroup/$wlinuxuser/tmp:/var/www/stashandcarry.com/web:/srv/www/stashandcarry.com/web:/usr/share/php5:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin",
            
'custom_php_ini'     => '',
            
'backup_interval'     => 'none',
            
'backup_copies'     => 1,
            
'active'             => 'y',
            
'traffic_quota_lock' => 'n'
            
);
                
            
$readonly false;
            
            echo 
"<br /> Session ID set is: $session_id <br />";
            echo 
"<br /> The items passed in <br /> ";
            
print_r($params);
            
            
$affected_rows $this -> ispclient -> sites_web_domain_add($inrecserverid$inrecclientid
            
$params$readonly);

            echo 
"Web Domain ID: ".$affected_rows."<br>";

            if(
$this -> ispclient ->logout($session_id)) {
                echo 
'Logged out.<br />';
            }
            
        } catch (
SoapFault $e) {
            echo 
$this -> ispclient ->__getLastResponse();
            die(
'SOAP Error ADD WEB DOMAIN: '.$e->getMessage());
        }
        
        return 
$affected_rows;
    } 


dgmufasa 24th October 2011 19:34

Hi again,

I found a solution in another thread and followed it. I still came up with an error.

What could be the problem?

TIA


=> Linux Group: client42 Linux User: web123 will be created <br /><br />Logged successfull. Session ID:b76646bfa8c47375953830dba53b67b1<br /><br /> Session ID set is: b76646bfa8c47375953830dba53b67b1 <br /><br /> The items passed in <br /> Array
(
[server_id] => 1
[ip_address] => *
[type] => vhost
[vhost_type] => name
[document_root] => /var/www/clients/client42/web123
[system_user] => web123
[system_group] => client42
[domain] => foofoo.com
[traffic_quota] => -1
[hd_quota] => -1
[cgi] => y
[ssi] => y
[suexec] => y
[errordocs] => y
[subdomain] => none
[php] => fast-cgi
[active] => y
)
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>session_does_not_exist</faultcode><faultstring>The Session is expired or does not exist.</faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>
SOAP Error ADD WEB DOMAIN: The Session is expired or does not exist.

till 24th October 2011 19:54

Every function in the API requires the session_id as first parameter as http is a stateless protocol. In your script you did not pass the session_id to the sites_web_domain_add function as first parameter.

dgmufasa 24th October 2011 21:54

Thanks so much for the response.

I guess I am tired. I never saw the problem at all :eek:

I have been making changes to the inputs. Here is the last one:

The items passed in
Array ( [server_id] => 1 [ip_address] => * [type] => vhost [vhost_type] => name [document_root] => /var/www/clients [system_user] => 49 [system_group] => 49 [domain] => foofoo.com [traffic_quota] => -1 [hd_quota] => -1 [cgi] => y [ssi] => y [suexec] => y [errordocs] => y [subdomain] => none [php] => fast-cgi [active] => y )

Are these OK to use? I saw this other thread:
http://www.howtoforge.com/forums/showthread.php?t=52837

But, at the same time, I am going off of what I had seen in the fields of the
"web_domain" table.

Any hints on this?

Thanks again for pointing out such an interesting mistake :o


All times are GMT +2. The time now is 19:00.

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