PHP: MySQL server has gone away

后端 未结 3 1726
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-10 06:04

I know this question has been asked numerous times but I\'ve tried everything.

I have a PHP script that iterates through thousands of images, performs resizing if ne

3条回答
  •  -上瘾入骨i
    2020-12-10 06:40

    This happens because the PHP script took too long to process whatever it was processing, and the connection to the server timed out. You have a few solutions:

    • Check to make sure the connection is still up, and reconnect if needed (mysql_connect has built-in functionality to do that for you)
    • Use mysql_pconnect (but remember to close the connection at the end because it won't close for you)
    • Improve the running time of your script to avoid the timeout.

提交回复
热议问题