opened
XanderCodes
username_0
Hello. My script connects to my server, but then i get this error:

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 1801678675 bytes) in C:\xampp\htdocs\PHP Testing\Rcon.php on line 207

Here is my index file that wouldnt work with GitHub's code thing(sorry for if the scripting is bad, i'm sorta new to php):

<?php include 'send.php';?>

<!DOCTYPE html>
<html>
<head>
<style>
.button {
    background-color: #4CAF50;
    border: none;
    color: white;
    padding: 15px 50px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 16px;
    margin: 4px 2px;
    cursor: pointer;
	border-radius: 8px;
}

.button:hover {
    box-shadow: 0 12px 16px 0 rgba(0,0,0,0.24), 0 17px 50px 0 rgba(0,0,0,0.19);
}
</style>
</head>
<body>

<form id="frm" method="post"  action="?action" >
<input type="submit" class="button" value="Send RCON" onclick="doSomething();">
</form>

</body>
</html>



And the send.php file:

<?php

				require_once('Rcon.php');
				  
				use username_2\Rcon;

$host = '192.168.0.234'; // Server host name or IP
$port = 27115;                      // Port rcon is listening on
$password = 'bapple'; // rcon.password setting set in server.properties
$timeout = 3;                       // How long to timeout. Default 3

$rcon = new Rcon($host, $port, $password, $timeout);

if ($rcon->connect())
{
  $rcon->send_command("say Hello World!");
}
?>

Thanks, Xander
Fatal Error about memory
issue
created
metroyanno
username_1
The error itself speaks for itself. You may not have enough RAM
comment
created
XanderCodes
username_0
For the server or the webhost?
comment
created
thedudeguy
username_2
Increase the memory_limit setting in your php settings.
comment
created
XanderCodes
username_0
I increased the Memory limit, but then it just wanted even more. I read up about the memory_limit setting, and found that if i set it to -1 it will take as much as it needs, but it still wanted more. The machine i'm running it on has 8gb, and i wouldn't think it would need that much??
comment
created
XanderCodes
username_0
Hello??
comment
created
MCMainiac
username_3
What happens when you turn off the time limit? (`set_time_limit(0);`)
comment
created
XanderCodes
username_0
I'll try it
comment
created
XanderCodes
username_0
This makes no difference, if i'm setting it right, i put it in my index.php under the variables for the server info??
comment
created
XanderCodes
username_0
I did try my code with a MINECRAFT server, and it worked flawlessly, so can i simply not use this script with my Unturned server? I have tried other scripts, and none of them work with this gameserver, would it just be easier to establish a telnet-like connection over PHP?
comment
created
thedudeguy
username_2
I haven't played Unturned so I don't know anything about it.  But I found some articles that stated it requires Rocket Mod in order to use RCON. Are you using that already?
comment
created
XanderCodes
username_0
RocketMod is like Bukkit for Unturned, but RCON is one of its features. For now I have resorted to making a PHP button run a script on the physical server, but it would be really nice to have it done through RCON.
comment
closed
thedudeguy
username_2
issue
created
thedudeguy
username_2
Ok, thanks. Since the original topic, having to with memory, is resolved, I'm going to close this issue. I've created a new Issue specifically for Unturned, though, so that this can be further discussed.  
See #21
comment