Open Sh4d0wless opened 1 week ago
Is fsockopen enabled or disabled on admin page?
If it is disabled, ask your host to enable outbound connections.
Make sure to use same php version for cron as one that you use for website.
Ex: /usr/local/bin/php /home/baxandre/cleanup.php
or /usr/local/bin/ea-php80 /home/baxandre/cleanup.php
i added simple code in lgsl_cron.php
if(function_exists("fsockopen")) {
echo "Function Exists";
} else {
echo "Function not exists";
}
Result is - Function Exists
CRON: /usr/local/bin/ea-php74 /home/sefgstxb/public_html/lgsl_files/lgsl_cron.php site is on PHP 7.4 with LGSL 6.21
may be issue is in outbound 80/443 ports ?
or any other ideas?
Try this
<?php
if(fsockopen("websistent.com",80))
{
print "I can see port 80";
}
else
{
print "I cannot see port 80";
}
?>
can be fwrite() error caused only by fsockopen
with ur code i got "I can see port 80"
then i tested with other (game ip:port)
if(fsockopen("80.241.245.222",1337)) { print "I can see port 1337"; } else { print "I cannot see port 1337"; }
and got this
Warning: fsockopen(): unable to connect to 80.241.245.222:1337
(Connection refused) in /home/sefgstxb/public_html/lgsl_files/lgsl_cron.php on line 20
I cannot see port 1337
i doubt fsockopen have to work for websites coz its allowed from php.ini with allow_url_fopen = On
but does not work for game IP:PORTs :(
You should have tested port 27105 instead of 1337 as there is no app listening on that port at the destination IP
Your host whitelisted some ports. Ask them to whitelist the ports that you need
Warning: fsockopen(): unable to connect to 80.241.245.222:27105 (Connection refused) in /home/sefgstxb/public_html/lgsl_files/lgsl_cron.php on line 20 I cannot see port 1337
same
This is host issue. Since lgsl is on the same box as the game servers it may be a NAT Loopback problem. Send a ticket to your host and ask them (they might need to enable outbound connections). If they refuse, ask them to enable traffic on the specific ports that you need.
so as i understend its shld be 80 & 443 outbound ports for fsockopen ? and is fwrite() error caused only by fsockopen ?
so as i understend its shld be 80 & 443 outbound ports for fsockopen ?
Yes and no. Excerpt from faq from one of the hosting companies:
The fsockopen function will work for outbound connections to any URL on port 80 (HTTP) or 443 (HTTPS). If fsockopen attempts to use another port, it will not work until we add that port to the firewall.
is fwrite() error caused only by fsockopen ?
Yes
tnx for ur help and time... <3
hello few days ago i transfered my web from VPS to shared hosting(with cpanel) on VPS everything was perfect, works well without any erros now im geting this error while cron runs
plz help me solve this problem....