thedudeguy / PHP-Minecraft-Rcon

Simple Rcon class for php.
MIT License
155 stars 54 forks source link

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

Open ItsTauTvyDas opened 6 years ago

ItsTauTvyDas commented 6 years ago

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

ricardoboss commented 6 years ago

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

ItsTauTvyDas commented 6 years ago

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

ricardoboss commented 6 years ago

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!

ItsTauTvyDas commented 6 years ago

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 ..

ricardoboss commented 6 years ago

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

ItsTauTvyDas commented 6 years ago

Yes, I do.

EDIT: Is this host mistake/error or something?

ItsTauTvyDas commented 6 years ago

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

ricardoboss commented 6 years ago

What do you mean by google play APP?

ItsTauTvyDas commented 6 years ago

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

ricardoboss commented 6 years ago

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

ItsTauTvyDas commented 6 years ago

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

ricardoboss commented 6 years ago

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

ItsTauTvyDas commented 6 years ago

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

ricardoboss commented 6 years ago

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)

ItsTauTvyDas commented 6 years ago

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

ricardoboss commented 6 years ago

Then provide a phpinfo(); output

ItsTauTvyDas commented 6 years ago

What output do you need? Core? System output?

ojgarciab commented 4 years ago

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.

ricardoboss commented 4 years ago

@ItsTauTvyDas

Epicalis commented 3 years ago

@ojgarciab @ricardoboss Help me please, the same problem

ojgarciab commented 3 years ago

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