2

Getting this error when I try to connect mikrotik router with PHP Pear2 API on shared windows hosting. I don't think I have permission to access php.ini

PHP Warning: stream_set_blocking() has been disabled for security reasons in D:\INETPUB\VHOSTS\mydomain.com\Mikrotek_router\PEAR2\Net\Transmitter\Stream.php on line 190

Plamen G
  • 4,729
  • 4
  • 33
  • 44
rahul chaurasia
  • 153
  • 1
  • 9

1 Answers1

0

It's silly that this function in particular would be disabled... I wonder why. You may try to contact your host, and see if they're willing to enable it, as there really isn't a good case against it.

Anyway, thank you for reporting this. I'll alter the API client to not unconditionally use that function. It normally uses it for encrypted connections where non-blocking streams are needed, but the function is always called regardless of whether it would alter the stream or not.

In the meantime, you can workaround this issue by commenting out line 169 of TcpClient.php (in that same folder). The line in question is:

        $this->setIsBlocking(parent::CRYPTO_OFF === $crypto);
boen_robot
  • 1,450
  • 12
  • 24