Reputation: 259
I'm making a simple utility in PHP to control my Minecraft server via UDP:
$fp = fsockopen('udp://host', 'port', $errno, $errstr);
if (!$fp)
error("Unable to connect!");
else {
fwrite($fp, $data['command'].':user:pass');
stream_set_timeout($fp, 5);
error(fread($fp, 128));
fclose($fp);
}
For some reason fwrite is throwing this error:
Notice: fwrite() [function.fwrite]: send of 20 bytes failed with errno=1 Operation not permitted in /homepages/44/d217581656/htdocs/xenforo/util/remoterestart/interface.php on line 22
Anyone know why?
Upvotes: 2
Views: 4965
Reputation: 8461
I'm going to go out on a limb and say you're probably not permitted to use sockets on your server. This is a fairly common thing to disable on most hosts.
Run a phpinfo()
and see if there is any socket
functions which are disabled, or contact your host and just ask.
Upvotes: 1