API: Mysql Update problem

Discussion in 'Developers' Forum' started by branov, Feb 13, 2012.

  1. branov

    branov New Member

    Hi there,

    I have problem with API command: sites_database_update I got this error:

    Wrong Version

    Please, can you help me what is wrong? My code is:

    $params = array(
                    'server_id' => $server_id,
                    'type' => 'mysql',
                    'database_name' => $database_name,
                    'database_user' => $database_name,
                    'database_password' => $database_password,
                    'database_charset' => $database_charset,
                    'remote_access' => 'y',
                    'remote_ips' => '%',
                    'active' => 'y',
     try {
      $first = $client->client_get_id($session_id,$ADM_User->ispid);
      $update = $client->sites_database_update($session_id, $first, $database_id, $params);
      return $res;     
     } catch (SoapFault $e) {
     	return $e->getMessage();
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Do other remote functions work? I'am not aware that "Wrong Version" is a error message from ISPConfig and I'am not able to find these words anywhere in the ISPConfig sources, so it might be a error message e.g. from PHP / SOAP.
  3. branov

    branov New Member

    I found the primary problem but... I have secondary problem...

    When a create a new database in api, the password has format like:


    But when I edit a mysql from api (sites_database_update) the password is like:


    And problem is, when I edit the password, I cannot login to database, which edit. In mysql log is that the password was changed, but I cannot login. I think, problem is in password hashing? Or..? Is this bug or its my problem?

    Thanks very mich
  4. branov

    branov New Member

    any ideas please? I cant continue in my work :(
  5. till

    till Super Moderator Staff Member ISPConfig Developer

    Thats a problem of your script. If you pass parameters to the sites_database_update, then the field database_password has to be empty if the password was not changed.
  6. branov

    branov New Member

    So I dont think its my script problem... When I change the password, I send it to sites_database_update as plain text. In dbispconfig is password change in hash format, but its not the same format like had password when I add database. It looks like different hashing in sites_database_add and sites_database_update.

    I hope you know what I mean :(

    Here is output from params sent to sites_database_update:

    Array ( [server_id] => 2 [type] => mysql [database_name] => d6ccc [database_user] => d6ccc [database_password] => noveheslo123 [database_charset] => utf8 [remote_access] => y [remote_ips] => % [active] => y )
  7. branov

    branov New Member

    I upgraded all from svn and now I get this error in editing:

    SOAP Error: Call to undefined method db::affectedRows()

    WTF? Im little bit nervous from this :( After every upgrade is something wrong :( One problem solving, another I find :(

    Please help me when may be problem... Same function - sites_database_update.

    EDIT: NOT only in this function, this error I got on every functions :((
  8. till

    till Super Moderator Staff Member ISPConfig Developer

    I guess you downloaded code from our svn trunk folder instead of using released code (the tar.gz download). Its the purpose of the svn trunk to upload code for testing, so this can be broken. SVN is not much tested development code, so dont use any svn trunk code on a production system or a server where you expect that it works after the update.

    If you need a usable system, then use either the stable tar.gz version or the svn stable branch:


    Dont use this branch:


    as ts the place where untested code is uploaded.
  9. branov

    branov New Member

    Im sorry, I run update_from_svn.sh script in /usr/local/ispconfig/server/scripts and I dont check what contains. I try to svn official branch.

    Thank you and sorry for my stupidity...
  10. branov

    branov New Member

    Everything works fine. Thanks.

    The last problem still away... When I update mysql password from api, in ispconfig database has changed, but has different hash format like newly created mysql database. Because this, I cannot login in to mysql with changed password.... :( I really dont know where is the problem... API result is 1 affected row, looks all is fine, but password is changed in different hash or.. I dont know....I dont know where look up for errors, or how debug...
  11. Matt43

    Matt43 New Member

    I'm also having this same MySQL Database Update Password Problem via API.

    This is what i've noticed.

    Updating password from ISPConfig to "test" works fine:
    web_database database_password field value is updated to:

    Updating password via API sites_database_update to "test" does not work:
    web_database database_password field value is updated to:

    Looks like the encryption/hash used is different.
    During API sites_database_add, the password is added properly.

    Any help/assistance here?
  12. Matt43

    Matt43 New Member

    Just an update.

    I see in database.tform.php:
    However, there is no "encryption" type of "MYSQL" here in remoting_lib.inc.php:
    First time i've looked at the actual coding of ISPConfig so i may be wrong but i assume the lib file is missing an elseif encryption == "MYSQL"? Please advise :)
  13. till

    till Super Moderator Staff Member ISPConfig Developer

    There is nothing missing in the current ISPConfig version and the database update function works fine. If there is something missing in your files, then you should update your server to ISPConfig

    Beside that, if you use the database update function, the password field has to be empty in case that that password has not been changed.
  14. Matt43

    Matt43 New Member

    Thanks for your reply.

    Did you see my last post right before your reply?

    should this not be instead the following (SIMILAR to the code to INSERT):
  15. till

    till Super Moderator Staff Member ISPConfig Developer

    Yes, your right. I did not see your post. I just looked at the insert branch which has all functions and not the update branch. I will fix that in svn stable.
  16. Matt43

    Matt43 New Member

    Glad i could help :)

Share This Page