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.

fsockopen Not Working

Discussion in 'General Discussion' started by donnie, Sep 20, 2003.

  1. donnie

    donnie Active Member

    Joined:
    May 23, 2003
    Messages:
    37
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    uk
    I am trying to use fsockopen() in PHP and But it's giving me an error. I have tried it on both Windows IIS and Linux redhad 7.3 but both are unable to connect to any URL.

    $fp = fsockopen("http://www.abc.com/a.php", "80");

    as soon as this code executes it gives me following error:


    Warning: fsockopen(): php_network_getaddresses: getaddrinfo failed: Name or service not known (is your IPV6 configuration correct? If this error happens all the time, try reconfiguring PHP using --disable-ipv6 option to configure) on line 3

    Warning: fsockopen(): unable to connect to http://www.abc.com/a.php:80 on line 3


    Please tell me why this error is comming........

    cPanel.net Support Ticket Number:
     
  2. Michael-MS

    Michael-MS Well-Known Member

    Joined:
    Apr 16, 2003
    Messages:
    144
    Likes Received:
    0
    Trophy Points:
    16
    Change it to: $fp = @fsockopen("http://www.abc.com/a.php", "80");
     
  3. amal

    amal Well-Known Member

    Joined:
    Nov 22, 2003
    Messages:
    155
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    India
    cPanel Access Level:
    Root Administrator
    Hi,

    If we add '@' to that, it just hides the warning message.. Is there any real fix for it... Telnet to the same website to port 80 from the server works.. But it's not able to connect from php..
     
  4. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    Do you have Sockets checked when you've built apache/php?
     
  5. cj-hosting

    cj-hosting Registered

    Joined:
    Apr 15, 2005
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    UK
    Curl

    Hi,

    Instead of using fsockopen, try using the CURL library.

    Alternatively, upgrade your PHP version.
     
    #5 cj-hosting, Apr 15, 2005
    Last edited: Apr 15, 2005
  6. amal

    amal Well-Known Member

    Joined:
    Nov 22, 2003
    Messages:
    155
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    India
    cPanel Access Level:
    Root Administrator
    I copied a php.ini from another server, and it works fine now... Only difference I could note over there was the
    "extension dir = ./ " in the old php.ini "
     
  7. sreevishnu

    sreevishnu Member

    Joined:
    Aug 18, 2003
    Messages:
    23
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    india
    Yes Amal, it is working when I removed the "./" for the "extension_dir" from the php.ini .
     
Loading...

Share This Page