Remote folder

Discussion in 'Server Operation' started by mrkhoros, Dec 5, 2013.

  1. mrkhoros

    mrkhoros New Member

    Hello .
    I wanted to use this api :
    private function _load()
    {
    $usessl = $this->_config['secure'];
    $host = $this->_config['host'];
    $username = $this->_config['username'];
    $password = $this->_config['password'];
    $host = ($usessl) ? 'https://'.$host : 'http://'.$host;

    $soap_location = $host.':8080/remote/index.php';
    $soap_uri = $host.':8080/remote/';

    if(!$this->_c instanceof SoapClient ) {
    // Create the SOAP Client
    $this->_c = new SoapClient(null, array('location' => $soap_location,
    'uri' => $soap_uri,
    'trace' => 1,
    'exceptions' => 1));


    but so far I can tell that my /remote/index.php is empty .. although the file exists but there is no php inside it. I wonder if anyone can tell me how I can use SOAPI to authenticate while my /remote/index.php is empty. also I need an explanation with the funcation of remote users .. what do they do and are they made for this purpose or they are unrelated ?
     
  2. Croydon

    Croydon ISPConfig Developer ISPConfig Developer

    The index.php inside the remote folder should not be empty.
    Check if your ispconfig installation is corrupt and maybe reinstall/update it.
     
  3. mrkhoros

    mrkhoros New Member

    err

    Actually index.php is not empty in the server but shows no result when i connect to it directly with url as : https://ip:8080/remote/index.php but I am pretty sure I am getting no connection to the server. Let me get this straight. the remote users I have created in ispconfig 3 panel is the way to get these API to work right ?! is there any php code that could verify me whether or not my server's remote is working ?

    Thanks
     
  4. Croydon

    Croydon ISPConfig Developer ISPConfig Developer

    Have you checked the example client scripts that are inside the ISPConfig download?
    It's in /remoting_client/examples/
     
  5. mrkhoros

    mrkhoros New Member

    Croydon Thank you for the suggestion . I have reviewed and used one of them as an instance and now I know what my problem is.

    running the following code and config file


    PHP:
    <?php

    $username 
    'me';
    $password '123';

    /*
    $soap_location = 'http://localhost:8080/ispconfig3/interface/web/remote/index.php';
    $soap_uri = 'http://localhost:8080/ispconfig3/interface/web/remote/';
    */

    $soap_location 'http://ip:8080/remote/index.php';
    $soap_uri 'http://ip:8080/remote/';

    ?>
    following

    PHP:
    <?php

    require('soap_config.php');


    $client = new SoapClient(null, array('location' => $soap_location,
                                         
    'uri'      => $soap_uri,
                                                                             
    'trace' => 1,
                                                                             
    'exceptions' => 1));


    try {
            if(
    $session_id $client->login($username,$password)) {
                    echo 
    'Logged successfull. Session ID:'.$session_id.'<br />';
            }
            
            
    //* Set the function parameters.
            
    $sys_userid 5;
            
            
    $client_record $client->client_get_id($session_id$sys_userid);

            
    print_r($client_record);
            
            if(
    $client->logout($session_id)) {
                    echo 
    'Logged out.<br />';
            }
            
            
    } catch (
    SoapFault $e) {
            echo 
    $client->__getLastResponse();
            die(
    'SOAP Error: '.$e->getMessage());
    }

    ?>

    And i receive " SOAP Error: Internal Server Error "
    how can I avoid this error ?
     
  6. Croydon

    Croydon ISPConfig Developer ISPConfig Developer

    Before you can avoid an error you need to know what error it is ;)
    Take a look at the apache error.log
     
  7. mrkhoros

    mrkhoros New Member

    These are what I could find in my /var/log/nginx/error.log that are somehow related to my remote folder


    2013/12/05 13:27:58 [error] 27303#0: *2144 FastCGI sent in stderr: "PHP message: PHP Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE)
    , expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in /usr/local/ispconfig/interface/lib/classes/remoting.inc.php on line 2147" while reading response header from upstream, client: 178.63.21.219, server: _, request: "POST /remote/index.php HTTP/1.1", upstream: "fastcgi://unix
    :/var/lib/php5-fpm/ispconfig.sock:", host: "halqe.com:4444"
     
  8. mrkhoros

    mrkhoros New Member

    my 2147 line in remote.inc.php is


    // $rec = $app->db->queryOneRecord("SELECT id FROM dns_soa WHERE origin like '".$origin."%'");
    $rec = $app->db->queryOneRecord("SELECT id FROM dns_soa WHERE origin LIKE '".$origin."%');

    I had to add the 2nd line months ago because of boxbilling
    if you look here : http://www.boxbilling.com.pl/Thread-Ispconfig-3

    they said :

    change :
    $rec = $app->db->queryOneRecord("SELECT id FROM dns_soa WHERE origin LIKE '$origin%'");
    to
    $rec = $app->db->queryOneRecord("SELECT id FROM dns_soa WHERE origin LIKE '".$origin."%');

    Do you think I should not have done this ? By changing it back ( removing the // ) do you think it may work and boxbilling was wrong ?
     
  9. Croydon

    Croydon ISPConfig Developer ISPConfig Developer

    So you are not using current stable (3.0.5.3) of ISPConfig...
    There is no such syntax error in there afaik.
     
  10. mrkhoros

    mrkhoros New Member

    I am using ispconfig 3.0.5.3 with Nginx on debian wheezy and aside from that code I have not made any other changes except for the port
     
  11. Croydon

    Croydon ISPConfig Developer ISPConfig Developer

    There is the error. The trailing quote in the query is missing - spelling error on their site:

    PHP:
    $rec $app->db->queryOneRecord("SELECT id FROM dns_soa WHERE origin LIKE '".$origin."%'");
    would be correct.
     

Share This Page