Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

PHP function fwrite() problem

Discussion in 'Workarounds and Optimization' started by filip212, Aug 27, 2017.

Tags:
  1. filip212

    filip212 Member

    Joined:
    Aug 22, 2017
    Messages:
    19
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Slovakia
    cPanel Access Level:
    Root Administrator
    Hello,
    I have problem with use php function fwrite().
    I have php server status script which use fsocket fwrite and some other functions.
    Installed CMS is php-fusion.
    All servers shows offline but when i disable firewall servers show Online.
    I have CSF firewall how i can configure it to all users will be able have server status script on their webpages please?
    Error is: fwrite(): send of 25 bytes failed with errno=1 Operation is not allowed Line: 342

    Line 342:
    fwrite($live_server, $packet);
    343 socket_set_timeout($live_server,1,0);
    344 $junk = fread($live_server,5);
    345 $status = socket_get_status($live_server);
    346 $do = 1;
    347 $server_info= "";
    348
    349 while($do)
    350 {
    351 $str_1 = fread($live_server,1);
    352
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,165
    Likes Received:
    1,371
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    You may need to allow outgoing connections over port 80 from the server's local IP address (127.0.0.1) for this to work.

    Thank you.
     
  3. filip212

    filip212 Member

    Joined:
    Aug 22, 2017
    Messages:
    19
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Slovakia
    cPanel Access Level:
    Root Administrator
    I added this:
    tcp|out|s=80|s=127.0.0.1
    udp|out|s=80|s=127.0.0.1

    To csf.allow and restarted firewall but it still doesnt work
    This is example of servers ip which websites try get server status:
    82.208.17.175:27022
    82.208.17.102:27433
    But port can be on that gameservers any...
     
  4. filip212

    filip212 Member

    Joined:
    Aug 22, 2017
    Messages:
    19
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Slovakia
    cPanel Access Level:
    Root Administrator
    I solved it with open UDP port 27433 but i need open more ports. I need open range 27000-28000 and 25565-25600 is it safe? I think when is it outbound connections no security risk is there but if is can you explain please?
     
  5. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,165
    Likes Received:
    1,371
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
Loading...

Share This Page