fsock error

Discussion in 'PHP' started by asgsoft, Aug 7, 2009.

  1. #1
    what can cause this error:

    PHP Warning:  fsockopen() [<a href='function.fsockopen'>function.fsockopen</a>]: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in
    Code (markup):

    I am using the function in a cron script and it keeps on being returned.

    Any ideas?
     
    asgsoft, Aug 7, 2009 IP
  2. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #2
    Means your DNS is not working properly.
     
    jestep, Aug 7, 2009 IP
  3. asgsoft

    asgsoft Well-Known Member

    Messages:
    1,737
    Likes Received:
    34
    Best Answers:
    0
    Trophy Points:
    160
    #3
    can you explain a little more what that means?

    also I don't get it every time the cron job operates. Just every now and then.
     
    asgsoft, Aug 7, 2009 IP
  4. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #4
    Basically, your script will query your server's DNS server for the address of the site/page you are trying to access.

    If the DNS server is unavailable or has an error, you will get the error that you are experiencing.

    Situations like this can be extremely difficult troubleshoot because there are many factors that could be causing the problem.

    I would first off see if you can find any errors in your DNS setup. I'm assuming you're using BIND. Your nameserver setup will be located in resolve.conf, usually int he /etc directory.

    Second, I would program some logic into your script. Something like if fsocketopen fail, do a sleep(5) or sleep(10) and retry. It would be a good idea to program the script to try 3 - 5 times total.

    Are you using a control panel to manage your server?
     
    jestep, Aug 7, 2009 IP
  5. asgsoft

    asgsoft Well-Known Member

    Messages:
    1,737
    Likes Received:
    34
    Best Answers:
    0
    Trophy Points:
    160
    #5
    I am using cPanel, so I don't know much about what you are saying, though I like the logic part and I think I'll incorporate it :)
     
    asgsoft, Aug 8, 2009 IP