Hello, I get SOAP Error: Forbidden on API request, Apache error log is empty, I am ruining script from the same machine as sever. Code: <?php $username = 'test'; $password = '******'; $soap_location = 'https://localhost:8080/remote/index.php'; $soap_uri = 'https://localhost:8080/remote/'; ?> Code: require 'soap_config.php'; $client = new SoapClient(null, array('location' => $soap_location, 'uri' => $soap_uri, 'trace' => 1, 'stream_context'=> stream_context_create(array('ssl'=> array('verify_peer'=>false,'verify_peer_name'=>false))) )); try { if($session_id = $client->login($username, $password)) { echo 'Logged successfull. Session ID:'.$session_id.'<br />'; } //* Set the function parameters. $client_id = 1; $params = array( 'server_id' => 1, 'database_user' => 'db_name2', 'database_password' => 'db_name2' ); $database_user_id = $client->sites_database_user_add($session_id, $client_id, $params); echo "Database ID: ".$database_user_id."<br>"; if($client->logout($session_id)) { echo 'Logged out.<br />'; } } catch (SoapFault $e) { echo $client->__getLastResponse(); die('SOAP Error: '.$e->getMessage()); }
Do you get the "Logged successfull. [sic] ..." message, and a session id created? If so, you could try/catch the soap login separately from creating a database user (and maybe separate from the logout, too), to see which of the parts is throwing a fault. You created a 'test' user under 'Remote users' not 'CP Users' ? Do you have Remote Access enabled, probably allowing 127.0.0.1? Do you have all the needed functions enabled for what your 'test' user needs to do?
Hello and than you for your kind response, only message i get is SOAP Error: Forbidden. user is created under remote users, i ticked remote access box in remote user settings, ips are empty which means any (i have tested under 127.0.0.1 same result). all the functions are enabled
Found error in log [Sat Feb 16 00:21:06.431348 2019] [access_compat:error] [pid 28424] [client 127.0.0.1:38158] AH01797: client denied by server configuration: /var/www/ispconfig/remote/index.php