Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1011457
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T09:14:14+00:00 2026-05-16T09:14:14+00:00

I have a problem with mysql connection. I have a php script which upload

  • 0

I have a problem with mysql connection.

I have a php script which upload photo, this script do that:


1) mysql connection
2) check user rights for uploading photo (I use a sql query for this)
3) Image processing
4) sql query for insering photo data in database


I have set a mysql connection timeout to 5 s.

Everything works great if the image processing time is less than 5s (mysql connection timeout) otherwise I got a error when the step 4) is executed, the error is "Mysql server has gone away".

So, I checked if the mysql connection was still alive after the image processing and the mysql connection died if the image processing time is more then 5s.

I added this code after the image processing (step 3)


if(!mysql_ping($conn)){
$conn = mysql_connect('localhost', 'mysqluser', 'mypass');
$db   = mysql_select_db('mydb',$conn);
}

but it doesn't work! this is my real problem.

var_dump($conn)

give a mysql ressource link but

mysql_select_db('mydb',$conn)

return FALSE, and

mysql_error()

return "mysql server has gone away"

Does anybody can help me?

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T09:14:14+00:00Added an answer on May 16, 2026 at 9:14 am

    Quote from http://dev.mysql.com/doc/refman/5.0/en/gone-away.html:

    The most common reason for the MySQL server has gone away error is that the server timed out and closed the connection.
    […]
    Some other common reasons for the MySQL server has gone away error are:
    * You (or the db administrator) has killed the running thread with a KILL statement or a mysqladmin kill command.
    * You tried to run a query after closing the connection to the server. This indicates a logic error in the application that should be corrected.
    * A client application running on a different host does not have the necessary privileges to connect to the MySQL server from that host.
    * You got a timeout from the TCP/IP connection on the client side. This may happen if you have been using the commands: mysql_options(…, MYSQL_OPT_READ_TIMEOUT,…) or mysql_options(…, MYSQL_OPT_WRITE_TIMEOUT,…). In this case increasing the timeout may help solve the problem.
    * You have encountered a timeout on the server side and the automatic reconnection in the client is disabled (the reconnect flag in the MYSQL structure is equal to 0).
    * You are using a Windows client and the server had dropped the connection (probably because wait_timeout expired) before the command was issued.

    etc.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 527k
  • Answers 527k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer This might be instructive: let Main() = let f(x) =… May 16, 2026 at 10:40 pm
  • Editorial Team
    Editorial Team added an answer After more digging i managed to post the SOAP to… May 16, 2026 at 10:40 pm
  • Editorial Team
    Editorial Team added an answer This can do the job: template <int> struct TypeTag {};… May 16, 2026 at 10:40 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

We have a function used within our PHP/MySQL application which returns basic configuration information,
I have a basic ajax application, which will not work, instead the php code
I have a html page that calls a php object to get some data
OK so what's the problem with this. I tried using MySQL JConnector for Java
this post is a long one sorry for that but the problem is complex
I already have done this: mysql_set_charset(utf8,$link); at the connection mysql_query(SET NAMES 'UTF8'); at the
I've been pulling my hear out over this problem for a few hours yesterday:
My setup: Ubuntu LAMP, application built w/ zend framework My Problem: I have a
I have a primarily Ajax-driven site, the content of which is populated by making
I'm using Flash Builder 4 Beta 2. I have it connecting to a PHP

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.