PHP-Minecraft-Rcon icon indicating copy to clipboard operation
PHP-Minecraft-Rcon copied to clipboard

[Not solved, please help!] Not working ^_^

Open ItsTauTvyDas opened this issue 6 years ago • 21 comments

The script is

require_once('rcon.php');

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

use Thedudeguy\Rcon;

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

if ($rcon->connect())
{
  $rcon->sendCommand("say test");
  echo $rcon->get_response();
} else {
  echo "no, lol";
}

And I get "no, lol" message in index file (without "else", I get nothing), what to do? I looked in console, command not sended. No error, no nothing

ItsTauTvyDas avatar Jul 09 '18 17:07 ItsTauTvyDas

How long does it load? Does it timeout or does connect() just return false instantly?

ricardoboss avatar Jul 09 '18 17:07 ricardoboss

You mean in browser? Page/file load in 1 sec

ItsTauTvyDas avatar Jul 09 '18 17:07 ItsTauTvyDas

But you set a timeout of 3 seconds...? Please check that you have error_reporting(E_ALL); somewhere before in your code or error_reporting = E_ALL in your php.ini and tell us if it makes a difference.

Please also check the contents of $rcon->lastResponse!

ricardoboss avatar Jul 09 '18 17:07 ricardoboss

Hm, I tried to change timeout setting, I get same message. And when I add error reporting to php: Warning: fsockopen(): unable to connect to some.ip.ip:25575 (Connection timed out) in /root ?/file/file/rcon.php on line 59 and when I back setting time out to 2 (even 3), error (Connection timed out) changed to (Connection refused) Sorry for english ..

ItsTauTvyDas avatar Jul 09 '18 17:07 ItsTauTvyDas

Do you have enable-rcon=true, rcon.port=25575 and rcon.password=fgdfgdfg set in your server.properties?

ricardoboss avatar Jul 09 '18 17:07 ricardoboss

Yes, I do.

EDIT: Is this host mistake/error or something?

ItsTauTvyDas avatar Jul 09 '18 18:07 ItsTauTvyDas

I have tried google play APP, server info or something, and I COULD connect.

ItsTauTvyDas avatar Jul 09 '18 18:07 ItsTauTvyDas

What do you mean by google play APP?

ricardoboss avatar Jul 09 '18 18:07 ricardoboss

I mean This app (application), I can connect to RCON, I enter password and it works!

ItsTauTvyDas avatar Jul 09 '18 19:07 ItsTauTvyDas

It must be something with your PHP setup then. I don't know what it could be though...

ricardoboss avatar Jul 09 '18 19:07 ricardoboss

Maybe this "Code/Source Code" don't support latest PHP version? I think its 7.2 (latest).. ?

ItsTauTvyDas avatar Jul 09 '18 19:07 ItsTauTvyDas

Please provide a link to a gist containing your php -i info

ricardoboss avatar Jul 09 '18 19:07 ricardoboss

What do you mean pvp -i? Info? <?php phpinfo(); ?> ?

ItsTauTvyDas avatar Jul 09 '18 19:07 ItsTauTvyDas

Just enter php -i into your servers console (or wherever you're running your PHP files on) to get information about your PHP installation. More information: http://php.net/manual/features.commandline.options.php (Scroll down to the -i option)

ricardoboss avatar Jul 09 '18 20:07 ricardoboss

I don't have webserver console, host is limited.

ItsTauTvyDas avatar Jul 09 '18 21:07 ItsTauTvyDas

Then provide a phpinfo(); output

ricardoboss avatar Jul 10 '18 11:07 ricardoboss

What output do you need? Core? System output?

ItsTauTvyDas avatar Jul 10 '18 15:07 ItsTauTvyDas

What output do you need? Core? System output?

Create a PHP file with <? phpinfo();. Type that PHP URL it in your browser and save the result web as HTML.

You can attach the HTML file downloaded to your reply.

ojgarciab avatar Jun 08 '20 12:06 ojgarciab

@ItsTauTvyDas

ricardoboss avatar Jun 08 '20 13:06 ricardoboss

@ojgarciab @ricardoboss Help me please, the same problem

Epicalis avatar May 19 '21 15:05 Epicalis

@Epicalis , please, provide a link to a gist containing your php -i or <?php phpinfo(); info. Thanks.

ojgarciab avatar Oct 04 '21 13:10 ojgarciab