internal server error and MySQL server has gone away

  • (2 Pages)
  • +
  • 1
  • 2

18 Replies - 808 Views - Last Post: 15 June 2020 - 04:26 AM Rate Topic: -----

#1 hshourie   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 22
  • Joined: 10-June 13

internal server error and MySQL server has gone away

Posted 10 June 2020 - 02:40 AM

error on browser terminating the script :
Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at [email protected] to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

in error log, there is warning:
PHP Warning: mysqli_query(): MySQL server has gone away in /home/includes/GenerateTreePointsGSB.php on line 302

already checked my code and tables,
running fine on local server XAMPP

Is This A Good Question/Topic? 0
  • +

Replies To: internal server error and MySQL server has gone away

#2 Dormilich   User is offline

  • 痛覚残留
  • member icon

Reputation: 4278
  • View blog
  • Posts: 13,563
  • Joined: 08-June 10

Re: internal server error and MySQL server has gone away

Posted 10 June 2020 - 02:57 AM

That's something you'd have to work out with your provider.
Was This Post Helpful? 0
  • +
  • -

#3 hshourie   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 22
  • Joined: 10-June 13

Re: internal server error and MySQL server has gone away

Posted 10 June 2020 - 03:07 AM

View PostDormilich, on 10 June 2020 - 02:57 AM, said:

That's something you'd have to work out with your provider.

new things need to learn no doubt about it. but as of now what is the solution
i had to change the whole code as per latest version which can be done in near future.
Was This Post Helpful? 0
  • +
  • -

#4 Dormilich   User is offline

  • 痛覚残留
  • member icon

Reputation: 4278
  • View blog
  • Posts: 13,563
  • Joined: 08-June 10

Re: internal server error and MySQL server has gone away

Posted 10 June 2020 - 03:20 AM

The error is "MySQL server has gone away". You yourself can only do something about that when you have control over the database server and hosting system.
Was This Post Helpful? 0
  • +
  • -

#5 hshourie   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 22
  • Joined: 10-June 13

Re: internal server error and MySQL server has gone away

Posted 10 June 2020 - 03:25 AM

View PostDormilich, on 10 June 2020 - 03:20 AM, said:

The error is "MySQL server has gone away". You yourself can only do something about that when you have control over the database server and hosting system.

i am already in chat with the hosting server. tell me what setting needs to change in this case.
already i make them change value of variable "wait_timeout" but of no effect.
Was This Post Helpful? 0
  • +
  • -

#6 Dormilich   User is offline

  • 痛覚残留
  • member icon

Reputation: 4278
  • View blog
  • Posts: 13,563
  • Joined: 08-June 10

Re: internal server error and MySQL server has gone away

Posted 10 June 2020 - 03:40 AM

I can't tell you because I'm not your hosting provider. it's a problem on their side.
Was This Post Helpful? 0
  • +
  • -

#7 hshourie   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 22
  • Joined: 10-June 13

Re: internal server error and MySQL server has gone away

Posted 10 June 2020 - 03:43 AM

View PostDormilich, on 10 June 2020 - 03:40 AM, said:

I can't tell you because I'm not your hosting provider. it's a problem on their side.

so it means no solution to this problem. atleast my code is right i guess and issue at hosting server..
Was This Post Helpful? 0
  • +
  • -

#8 Dormilich   User is offline

  • 痛覚残留
  • member icon

Reputation: 4278
  • View blog
  • Posts: 13,563
  • Joined: 08-June 10

Re: internal server error and MySQL server has gone away

Posted 10 June 2020 - 03:57 AM

What you should do is adding some error handling code that caters for this case. You should send (or redirect to) a proper error page. Just letting an internal server error pass untreated reflects bad on your page.
Was This Post Helpful? 0
  • +
  • -

#9 ArtificialSoldier   User is offline

  • D.I.C Lover
  • member icon

Reputation: 2760
  • View blog
  • Posts: 8,066
  • Joined: 15-January 14

Re: internal server error and MySQL server has gone away

Posted 10 June 2020 - 12:07 PM

How long does it take before you get that error? Is it immediate?
Was This Post Helpful? 0
  • +
  • -

#10 hshourie   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 22
  • Joined: 10-June 13

Re: internal server error and MySQL server has gone away

Posted 11 June 2020 - 02:27 AM

View PostArtificialSoldier, on 10 June 2020 - 12:07 PM, said:

How long does it take before you get that error? Is it immediate?

Hi
it will hardly take 10 minutes when error displayed.
i had chat with my hosting provider and get the apache error log which states as below:

ModSecurity: Output filter: Failed to read bucket (rc 70007): The timeout specified has expired [hostname.....

now they updated cmc at server level...
i have to rerun my script and see the result again..
Was This Post Helpful? 0
  • +
  • -

#11 hshourie   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 22
  • Joined: 10-June 13

Re: internal server error and MySQL server has gone away

Posted 11 June 2020 - 03:22 AM

View Posthshourie, on 11 June 2020 - 02:27 AM, said:

View PostArtificialSoldier, on 10 June 2020 - 12:07 PM, said:

How long does it take before you get that error? Is it immediate?

Hi
it will hardly take 10 minutes when error displayed.
i had chat with my hosting provider and get the apache error log which states as below:

ModSecurity: Output filter: Failed to read bucket (rc 70007): The timeout specified has expired [hostname.....

now they updated cmc at server level...
i have to rerun my script and see the result again..

script fail again with the same error. internal server error
Was This Post Helpful? 0
  • +
  • -

#12 ArtificialSoldier   User is offline

  • D.I.C Lover
  • member icon

Reputation: 2760
  • View blog
  • Posts: 8,066
  • Joined: 15-January 14

Re: internal server error and MySQL server has gone away

Posted 11 June 2020 - 11:14 AM

It's running for 10 minutes? If that's true, then you might need to find the SQL statement that is raising the error about MySQL not being there, and re-connect to the database before the next query. There are a lot of things you can change on MySQL to affect that, but if you don't have the ability to change that stuff then it might be your only option.

We have some tasks that need to run once per day, and for some of our clients we have some queries that take longer to finish than the MySQL timeout. So, after the query finally finishes successfully, the MySQL connection has expired and closed. The fix for that, instead of continually increasing the timeout to very high values, was to just connect again to the database before the next query. The smaller clients that don't take very long have additional connection overhead, but at least the large ones finish.

There's also a setting in MySQL for the largest query packet size allowed. If you are sending very large queries to MySQL, you might need to break them up into several smaller queries.
Was This Post Helpful? 0
  • +
  • -

#13 CTphpnwb   User is offline

  • D.I.C Lover
  • member icon

Reputation: 3837
  • View blog
  • Posts: 13,994
  • Joined: 08-August 08

Re: internal server error and MySQL server has gone away

Posted 12 June 2020 - 11:16 PM

Check that the appropriate fields are indexed. If you have large tables and joins or where clause on fields that are not indexed the query could take much longer than necessary.
Was This Post Helpful? 0
  • +
  • -

#14 hshourie   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 22
  • Joined: 10-June 13

Re: internal server error and MySQL server has gone away

Posted 12 June 2020 - 11:39 PM

View PostCTphpnwb, on 12 June 2020 - 11:16 PM, said:

Check that the appropriate fields are indexed. If you have large tables and joins or where clause on fields that are not indexed the query could take much longer than necessary.

there is no index placed on any field, only primary key set. sequence of actions are we have input form for start and end date.
it will see records in table for every date in between and check some conditions and then insert data into tables.
first 2 functions called on submit runs fine and all records inserted.
but issue is on reaching 3rd function and script terminate in between , it do insert some records into table but do not finish the task. i had almost 7 more functions to run after that.
for now i m just trying the first functin
Was This Post Helpful? 0
  • +
  • -

#15 hshourie   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 22
  • Joined: 10-June 13

Re: internal server error and MySQL server has gone away

Posted 13 June 2020 - 12:58 AM

View Posthshourie, on 12 June 2020 - 11:39 PM, said:

View PostCTphpnwb, on 12 June 2020 - 11:16 PM, said:

Check that the appropriate fields are indexed. If you have large tables and joins or where clause on fields that are not indexed the query could take much longer than necessary.

there is no index placed on any field, only primary key set. sequence of actions are we have input form for start and end date.
it will see records in table for every date in between and check some conditions and then insert data into tables.
first 2 functions called on submit runs fine and all records inserted.
but issue is on reaching 3rd function and script terminate in between , it do insert some records into table but do not finish the task. i had almost 7 more functions to run after that.
for now i m just trying the first functin

error repeats after indexing the fields
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2