Resultaten 1 tot 6 van de 6
Geen
  1. #1
    Plesk RPC Api issues
    www.xenius.be
    1.555 Berichten
    Ingeschreven
    26/11/11

    Locatie
    Oud-Turnhout

    Post Thanks / Like
    Mentioned
    43 Post(s)
    Tagged
    0 Thread(s)
    73 Berichten zijn liked


    Naam: Steve Vos
    Bedrijf: Xenius
    Functie: Zaakvoerder
    URL: www.xenius.be
    Ondernemingsnummer: 0505928838

    Thread Starter

    Plesk RPC Api issues

    [Dit bericht is ook geplaatst op het Parallels forum, vandaar het engels]

    Since last week I'm running in trouble with the Plesk RPC api. At the moment I'm in the progress of developing a custom made PHP-script to handle orders at my website, when a customers buys webhosting at the shop the script automatically creates the user account, creates the domain, add aliasses and all other stuff.
    My script was working till last week and since then I've trouble with just 1 part of the script the creation of the domain itself. Creating of the user is working as expected.

    The thing is it is a really strange issue as the domain itself is created on plesk but the output that I expect is not returned by plesk. Let me explain this a bit with some php snippets:

    This is the code that is giving errors:
    Code:
    $xmlPacket2=createXML_DomainADD($domeinen[0],$kl_guid,strtolower($ftp_username),$ftp_password,$pakket);
    $curl2 = sendCommand($xmlPacket2,$HOST,$PATH,$LOGIN,$PASSWD);
    $response = parseCurl($curl2);
    The first line createXML_DomainAdd creates a valid XML package to send to plesk, something like this:
    Code:
    <packet version="1.6.3.1">
    <webspace>
    	<add>
    		<gen_setup>
    			<name>test.com</name>
    			<owner-guid>ab70944d-b591-4063-8131-768d00b15a3a</owner-guid>
    			<htype>vrt_hst</htype>
    			<ip_address>A.B.C.D</ip_address>
    			<status>0</status>
    		</gen_setup>
    		<hosting>
    			<vrt_hst>
    				<property>
    					<name>ftp_login</name>
    					<value>ftp_login</value>
    				</property>
    				<property>
    					<name>ftp_password</name>
    					<value>cuji83cx</value>
    				</property>
    				<ip_address>A.B.C.D</ip_address>
    			</vrt_hst>
    		</hosting>
    		<plan-name>X1</plan-name>
    	</add>
    </webspace>
    </packet>
    After the packet creation the packet is send to plesk with the SendCommand function:
    Code:
    function sendCommand($xmlPacket,$host,$path,$login,$passwd)
    {
    	$url = "https://" . $host . ":8443". "/" . $path;
    
    	$headers = array(
    	"HTTP_AUTH_LOGIN: " . $login,
    	"HTTP_AUTH_PASSWD: " . $passwd,
    	"HTTP_PRETTY_PRINT: TRUE",
    	"Content-Type: text/xml",
    	);
    	// Initalize the curl engine
    	$ch = curl_init();
    	// Set the curl options
    	curl_setopt($ch,CURLOPT_URL,$url);
    	curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
    	curl_setopt($ch,CURLOPT_POST,true);
    	curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false);
    	curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,false);
    	curl_setopt($ch,CURLOPT_HTTPHEADER,$headers);
    	curl_setopt($ch,CURLOPT_POSTFIELDS,$xmlPacket);
    	curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,60);
    	curl_setopt($ch,CURLOPT_STDERR,'logs.log');
    	curl_setopt($ch,CURLOPT_VERBOSE,1);
    	
    	return $ch;
    }
    And after that the output returned from plesk is analysed in ParseCurl function:

    Code:
    function parseCurl($ch){
    	$result = curl_exec($ch);
    	$info=curl_getinfo($ch);
    	
    	
    	if($info['http_code']!=200){
    	
    		return false;
    	}else{
    		$xml = new SimpleXMLElement($result);
    		if(!is_a($xml,'SimpleXMLElement')){
    			
    			return false;
    		}else{
    			return $xml;
    	
    		}
    	}
    	
    	curl_close($ch);
    }
    When I'm trying to load this in Firefox the following is taking place:
    - The xml packet is created
    - XML packet is send to Plesk
    - Plesk created the domain and domain is working fine
    - I retreive an "Connection has been re-initialized" window in Firefox and the script stops here
    - NO return output is retreived from plesk

    when I do the same in Internet Explorer, i didn't receive the connection has been re-initialized screen but the pages loads, a white screen comes up and the page loads again.

    After some troubelshooting I've found that Plesk is not returning any value in the parseCurl function, the status code that I retreive from $info['http_code'] is 0.

    I can't get what's going wrong but I'm pretty sure that there is something wrong at plesk side now (as it was working till last week).
    I installed latest updates today and also rebooted the server, but no luck..

    Found a very similar thread but without any solutions :/

    http://forum.parallels.com/showthrea...ght=rpc+domain

  2. #2
    Plesk RPC Api issues
    [--]
    854 Berichten
    Ingeschreven
    28/05/06

    Locatie
    Eindhoven

    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    67 Berichten zijn liked


    Naam: R
    Registrar SIDN: ja
    KvK nummer: 20125757

    If this is a managed server, a lot of hosts disabled the rpc-api port on their servers due to the recent plesk hacks. So check if your requests are appearing in your rpc log.

  3. #3
    Plesk RPC Api issues
    www.xenius.be
    1.555 Berichten
    Ingeschreven
    26/11/11

    Locatie
    Oud-Turnhout

    Post Thanks / Like
    Mentioned
    43 Post(s)
    Tagged
    0 Thread(s)
    73 Berichten zijn liked


    Naam: Steve Vos
    Bedrijf: Xenius
    Functie: Zaakvoerder
    URL: www.xenius.be
    Ondernemingsnummer: 0505928838

    Thread Starter
    Ik heb net even alle stukken code genomen in een apart test scriptje gezet:

    Code:
    <?php
    //***************************************************
    $HOST='localhost';
    $PATH='enterprise/control/agent.php';
    $LOGIN='PLESKUSERNAME';
    $PASSWD='PLESKPSW';
    //***************************************************
    
    $xmlPacket2=createXML_DomainADD("test.be","b6c65563-f7da-4d07-bca3-330c64674331","test_be","mySeCret","X1");
    //$xmlPacket2=createXML_DomainADD($domeinen[0],$kl_guid,strtolower($ftp_username),$ftp_password,$pakket);
    echo($xmlPacket2);
    $curl2 = sendCommand($xmlPacket2,$HOST,$PATH,$LOGIN,$PASSWD);
    
    $response = parseCurl($curl2);
    
    print_r("<br />------RESPONSE:-----<br />");
    print_r($response);
    //*******************************************************
    
    function createXML_CustomerADD($naam,$bedrijf,$email,$paswoord,$tel,$email,$adres,$gemeente,$postcode,$land,$username){
    
    	$data =<<<EOF
    <?xml version="1.0" encoding="UTF-8" standalone="no" ?>
    <packet version="1.6.3.1">
    <customer>
    	<add>
    		<gen_info>
    			<cname>$bedrijf</cname>
    			<pname>$naam</pname>
    			<login>$username</login>
    			<passwd>$paswoord</passwd>
    			<status>0</status>
    			<phone>$tel</phone>
    			<email>$email</email>
    			<address>$adres</address>
    			<city>$gemeente</city>
    			<pcode>$postcode</pcode>
    			<country>$land</country>
    			
    		</gen_info>
    	</add>
    </customer>
    </packet>
    EOF;
    
    return $data;
    }
    
    function createXML_DomainADD($domein,$klant_guid,$ftp_username,$ftp_password,$service_plan){
    
    	$data =<<<EOF
    <?xml version="1.0" encoding="UTF-8" standalone="no" ?>
    <packet version="1.6.3.1">
    <webspace>
    	<add>
    		<gen_setup>
    			<name>$domein</name>
    			<owner-guid>$klant_guid</owner-guid>
    			<htype>vrt_hst</htype>
    			<ip_address>A.B.C.D</ip_address>
    			<status>0</status>
    		</gen_setup>
    		<hosting>
    			<vrt_hst>
    				<property>
    					<name>ftp_login</name>
    					<value>$ftp_username</value>
    				</property>
    				<property>
    					<name>ftp_password</name>
    					<value>$ftp_password</value>
    				</property>
    				<ip_address>A.B.C.D</ip_address>
    			</vrt_hst>
    		</hosting>
    		<plan-name>$service_plan</plan-name>
    	</add>
    </webspace>
    </packet>
    EOF;
    
    return $data;
    }
    
    function checkResponse_DOMAIN(SimpleXMLElement $response){
    	$resultNode=$response->webspace->add->result;
    	if('error'== (string)$resultNode->status){
    		return (int)$resultNode->errcode;
    	}else{
    		$output[0]=$resultNode->guid;
    		$output[1]=$resultNode->id;
    		return $output;
    	}
    }
    
    function sendCommand($xmlPacket,$host,$path,$login,$passwd)
    {
    	$url = "https://" . $host . ":8443". "/" . $path;
    
    	$headers = array(
    	"HTTP_AUTH_LOGIN: " . $login,
    	"HTTP_AUTH_PASSWD: " . $passwd,
    	"HTTP_PRETTY_PRINT: TRUE",
    	"Content-Type: text/xml",
    	);
    	// Initalize the curl engine
    	$ch = curl_init();
    	// Set the curl options
    	curl_setopt($ch,CURLOPT_URL,$url);
    	curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
    	curl_setopt($ch,CURLOPT_POST,true);
    	curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false);
    	curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,false);
    	curl_setopt($ch,CURLOPT_HTTPHEADER,$headers);
    	curl_setopt($ch,CURLOPT_POSTFIELDS,$xmlPacket);
    	curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,60);
    	curl_setopt($ch,CURLOPT_VERBOSE,1);
    	
    	return $ch;
    }
    //Function for parsing the CURL response..
    function parseCurl($ch){
    	$result = curl_exec($ch);
    	$info=curl_getinfo($ch);
    	echo("<br />****CURL ERROR***********<br />");
    	print_r(curl_error($ch));	
    	echo("<br />****CURL HTTP INFO ********<br />");
    	echo("HTTP STATUS CODE: ".$info['http_code']);
    	if($info['http_code']!=200){
    		return false;
    	}else{
    		$xml = new SimpleXMLElement($result);
    		if(!is_a($xml,'SimpleXMLElement')){
    			return false;
    		}else{
    			return $xml;
    	
    		}
    	}
    	
    	curl_close($ch);
    }
    ?>
    Als ik dit op mijn lokale PHP/APACHE/MYSQL server draai werkt dit perfect, draai ik het rechtstreeks op mijn pleskserver dan krijg ik het hierboven beschreven fenomeen.

    in /var/log/httpd/error_log zie ik ook telkens na het uitvoeren van de request een "caught SIGTERM,shutting down":

    Code:
    [Sun May 13 10:39:56 2012] [notice] Apache/2.2.15 (Unix) DAV/2 mod_fcgid/2.3.6 mod_python/3.3.1 Python/2.6.6 mod_ssl/2.2.15 OpenSSL/1.0.0-fips mod_perl/2.0.4 Perl/v5.10.1 configured -- resuming normal operations
    * About to connect() to SERVER port 8443 (#0)
    *   Trying A.B.C.D... * connected
    * Connected to SERVER (A.B.C.D) port 8443 (#0)
    * Initializing NSS with certpath: /etc/pki/nssdb
    * skipping SSL peer certificate verification
    * SSL connection using TLS_RSA_WITH_AES_256_CBC_SHA
    * Server certificate:
    *       subject: CN=web1.xenius.be,OU=Domain Control Validated,O=SERVER
    *       start date: May 10 16:46:21 2012 GMT
    *       expire date: May 10 16:46:21 2013 GMT
    *       common name: SERVER
    *       issuer: serialNumber=07969287,CN=Go Daddy Secure Certification Authority,OU=http://certificates.godaddy.com/repository,O="GoDaddy.com, Inc.",L=Scottsdale,ST=Arizona,C=US
    > POST /enterprise/control/agent.php HTTP/1.1
    Host: SERVER:8443
    Accept: */*
    HTTP_AUTH_LOGIN: PLESKUSERNAME
    HTTP_AUTH_PASSWD: PLESKPASSWORD
    HTTP_PRETTY_PRINT: TRUE
    Content-Type: text/xml
    Content-Length: 639
    
    [Sun May 13 10:47:21 2012] [notice] caught SIGTERM, shutting down
    Plesk information:

    OS Linux 2.6.32-220.4.1.el6.x86_64
    Panel version 10.4.4 Update #30
    Laatst gewijzigd door bibawa; 13/05/12 om 11:00.

  4. #4
    Plesk RPC Api issues
    www.xenius.be
    1.555 Berichten
    Ingeschreven
    26/11/11

    Locatie
    Oud-Turnhout

    Post Thanks / Like
    Mentioned
    43 Post(s)
    Tagged
    0 Thread(s)
    73 Berichten zijn liked


    Naam: Steve Vos
    Bedrijf: Xenius
    Functie: Zaakvoerder
    URL: www.xenius.be
    Ondernemingsnummer: 0505928838

    Thread Starter
    Hi Davinci,

    This is only taking place with the "Add Webspace" request, i can create customers via api perfectly.

  5. #5
    Plesk RPC Api issues
    www.xenius.be
    1.555 Berichten
    Ingeschreven
    26/11/11

    Locatie
    Oud-Turnhout

    Post Thanks / Like
    Mentioned
    43 Post(s)
    Tagged
    0 Thread(s)
    73 Berichten zijn liked


    Naam: Steve Vos
    Bedrijf: Xenius
    Functie: Zaakvoerder
    URL: www.xenius.be
    Ondernemingsnummer: 0505928838

    Thread Starter
    Issue resolved:

    It seems that after each change of a webspace (create,update,delete) plesk automatically restart. The time between change and restart is defined with the "Apache restart Interval" parameter found under settings > server settings > Apache restart Interval. By default his is set to 0 which means that immediately after each change plesk is restarted which result off course in an interruption of the script execution.

    After setting this value to 300 the script is working fine now and after 5 minutes of webspace creation apache is restarted.

  6. #6
    Plesk RPC Api issues
    Web hosting diensten
    4.705 Berichten
    Ingeschreven
    09/02/04

    Locatie
    Rotterdam

    Post Thanks / Like
    Mentioned
    10 Post(s)
    Tagged
    0 Thread(s)
    110 Berichten zijn liked


    Bedrijf: DreamHost.nl Web hosting
    Functie: Managing Director
    URL: www.dreamhost.nl
    Registrar SIDN: JA
    KvK nummer: 24269577

    Ik denk dat hier wel meer Plesk gebruikers wat aan zullen hebben. Misschien een idee om dit ook op het Plesk forum te posten. Zoals je al zelf aangaf ben je niet de enige met dit probleem.
    DreamHost.nl Web hosting - cPanel hosting om bij weg te dromen.

Webhostingtalk.nl

Contact

  • Rokin 113-115
  • 1012 KP, Amsterdam
  • Nederland
  • Contact
© Copyright 2001-2026 Webhostingtalk.nl.
Web Statistics