Tuesday, March 1, 2011

php import to mysql hosted on godaddy

Yeah, I know! It's not my choice.

I am doing a large data import using a PHP script into a mysql DB hosted on godaddy. It seems their mysql connection gets killed every few hours regardless of what work it's doing. Their tech support is useless, and I've exhausted myself writing attempted workarounds. Right now, I'm trying to do a mysql_ping every few minutes, and if the ping returns false, I attempt to open up a new db connection.

My script (which takes many hours to complete), keeps failing with the very unhelpful message of "mysql server has gone away". I understand mysql trying to close a connection that's been open too long, but the connection is not idle-- it's busy basically the whole time, and with the pings I've written in, it should not be idle longer than 5 minutes at most at any time.

(These same scripts work with no errors on Amazon AWS servers, my local servers, etc.)

Any help most appreciated! I'm about to give up.

From stackoverflow
  • This makes complete sense to me. I've worked with many different hosting companies and almost all (the good ones anyway) will kill long running processes on any servers to keep it running trim and snappy for all the other people on the shared box.

    In short, don't import everything all at once, or perhaps contact godaddy support and try to give them a mysql dump (they may be able to import it for you)

    julio : I'm not importing everything at once, which is the odd thing. I even tried closing the connection and re-opening it after each segment and I still get the "gone away" error. Not sure what's up with that, though I assume it's something to do with their load balancing/clustering.

0 comments:

Post a Comment