[FIXED] WriteFile() XMLRPC call still errors on Linux

Moderator: NADEO

Post Reply
User avatar
Chris92
Translator
Translator
Posts: 950
Joined: 15 Jun 2010, 13:22
Location: Vilshofen, Germany
Contact:

[FIXED] WriteFile() XMLRPC call still errors on Linux

Post by Chris92 »

Hello xbx and others,
WriteFile() still seems to be broken on Linux dedicated servers, even after the attempted fixes.
Disregarding the too low max_request_size in the dedicated-server-api I'm still struggling to write files via the WriteFile() XMLRPC method.

My setup: Ubuntu 16.04 LTS
Server installed via the NADEO APT repository (in /opt/maniaplanet-server)

I'm trying to send files to the server, but the only error I'm getting is

Code: Select all

couldn't write file '/opt/maniaplanet-server/UserData/Maps'.
This is the PHP script I'm using:

Code: Select all

<?php
/**
 * Created by PhpStorm.
 * User: chris
 * Date: 10.01.2019
 * Time: 20:30
 */
require_once("./vendor/autoload.php");
class Main{
    //settings
    private $host = "IP_ADDRESS";
    private $port = "PORT";
    private $user = "SuperAdmin";
    private $pw = "SUPER_SECRET_PASSWORD";


    private function connect(){
        $conn = \Maniaplanet\DedicatedServer\Connection::factory($this->host, $this->port, 5, $this->user, $this->pw);
        $conn->triggerModeScriptEvent("XmlRpc.SetApiVersion", ["2.1.0"]);
        return $conn;
    }

    public function TryWriteFile(){
        $conn = $this->connect();
        $filename = "OTHERWORLD.Map.Gbx";
        $file = file_get_contents($filename);

        try{
            $conn->writeFile($filename, base64_encode($file));
            $conn->addmap($filename);
        }
        catch (Exception $ex){
            echo $ex->getMessage();
        }
    }
}

$main = new Main();
$main->TryWriteFile();
Directory permissions are 775 for UserData and Maps, user to run the server is in the games group and I've also tried running the server as root to no avail.

The map I'm using to test is Otherworld by Snake55wildcat

I hope we can get this nasty error resolved once and for all.
Last edited by Chris92 on 12 Feb 2019, 19:06, edited 1 time in total.
Check out my Personal Twitter account!
User avatar
Chris92
Translator
Translator
Posts: 950
Joined: 15 Jun 2010, 13:22
Location: Vilshofen, Germany
Contact:

Re: WriteFile() XMLRPC call still errors on Linux

Post by Chris92 »

Thanks to Miss, we might have narrowed down the source of the error.
Somehow the Linux server doesn't find the file name it should write the data in.
Tried with two Maps, one smaller map (332kb) and OTHERWORLD from above (1800kb)
Check out my Personal Twitter account!
User avatar
Miss
Posts: 2151
Joined: 05 Jan 2016, 11:34
Location: The Netherlands
Contact:

Re: WriteFile() XMLRPC call still errors on Linux

Post by Miss »

Worth noting I'm only assuming that because of the specific error not including any filename.
3080 RTX, Ryzen 3700X, 32GB RAM, Windows 11
Forum moderator, opinions are my own. :thx:
Check out Image openplanet, the alternative ManiaPlanet & Turbo scripting platform! (Openplanet subforum)
I also stream and tweet.
User avatar
Chris92
Translator
Translator
Posts: 950
Joined: 15 Jun 2010, 13:22
Location: Vilshofen, Germany
Contact:

Re: WriteFile() XMLRPC call still errors on Linux

Post by Chris92 »

Seems to be fixed with the latest server version, according to initial tests.
Check out my Personal Twitter account!
Post Reply

Return to “Dedicated Server”

Who is online

Users browsing this forum: No registered users and 0 guests