MySQL server has gone away

Discussion in 'PHP' started by stephan2307, Jan 20, 2012.

  1. #1
    Hi,

    One of my scripts gets a

    "MySQL server has gone away" error

    I tried various things to fix it but nothing worked. Can anyone give me suggestions on what I could try?
     
    stephan2307, Jan 20, 2012 IP
  2. stephan2307

    stephan2307 Well-Known Member

    Messages:
    1,277
    Likes Received:
    33
    Best Answers:
    7
    Trophy Points:
    150
    #2
    Right so I had a look and there are no big SELECT or UPDATE queries. All of the SELECT or UPDATE queries have a LIMIT 1.
    I randomly connected again to the db to ensure it doesn't time out.

    so not sure what else I can check.
     
    stephan2307, Jan 20, 2012 IP
  3. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #3
    Do you have access to the server's log files? Most of the time, you will see errors in the mysql error log that will better explain what the actual problem is.
     
    jestep, Jan 20, 2012 IP
  4. stephan2307

    stephan2307 Well-Known Member

    Messages:
    1,277
    Likes Received:
    33
    Best Answers:
    7
    Trophy Points:
    150
    #4
    Nope. I am on a shared hosting account and the log contains logs from other clients so they can't give them to me
     
    stephan2307, Jan 20, 2012 IP
  5. Alex Roxon

    Alex Roxon Active Member

    Messages:
    424
    Likes Received:
    11
    Best Answers:
    7
    Trophy Points:
    80
    #5
    It's a bit hard without seeing the code. I think the best thing to do in this instance is progressively work through your script to determine what exactly is triggering the error. O
     
    Alex Roxon, Jan 21, 2012 IP