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

  • SEARCH
  • Home
  • 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 8506473
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T02:36:02+00:00 2026-06-11T02:36:02+00:00

So I have this problem when I run a script with PHP PDO that

  • 0

So I have this problem when I run a script with PHP PDO that I’m not able to resolve. My script is indexing informations from different databases on different server (mostly Select queries).

When I was developing the script, all the databases were on the same server and everything was running fine. Now that I move the databases on three different server, I get this dreaded error.

So this is what happens everytime I run my script :

The script runs fine, until a point (and it crashes there every time) where it runs this simple query :

(Note, the script is in PHP and I’m using PHP PDO to access my DB and work with it)

SELECT *
FROM a_table
WHERE a_column = a_value.

Then it crashes and I get this error :

[a_date] - trunk - FATAL - Unmanaged Exception of type 'App_Exception'
File: /.../.../.../a_php_file.php
Line: a_line
Message: Error executing query.
Info:
Array
(
    [0] => HY000
    [1] => 2006
    [2] => MySQL server has gone away
)

Trace:
 #0 /.../.../.../a_php_file.php(124): App_something::a_metho('a_variable...')

I’ve searched for a long time and still haven’t found a solution.

I tried:

  • Modifiying the max_allowed_packed in /etc/my.cnf (on the sql on which occurs the crash) to set it from 16M to 64M (even though the results the query return is really not that big).

  • Modifiying the max_connections to allow more in case I forgot to kill some already existing connections.

  • Checking for a problem on the network

  • Many other little things such a connection from the host to the remote sql server.

What is really weird is that it runs fine if I run the query alone and it also works fine if all the databases are on the same server.

I’m really lost at this point and have no idea of where the problem could come from and that’s why I’m coming to ask for help or just a hint.

This is the method that crashes at the exception:

public static function my_method($my_mysql_WHERE_variable)
{
    //======================================
    // cached?
    //======================================
    if(isset(self::$_table1[$my_mysql_WHERE_variable])) {
      return self::$_table1[$my_mysql_WHERE_variable];
    }

    $pdo = my_App::getConnection();

    $query = "SELECT *
              FROM
                a_table
              WHERE
                a_column = :my_mysql_WHERE_variable";
    $stmt = $pdo->prepare($query);

    if($stmt === false) { 
        **---------------IT CRASHES HERE-----------**
        throw new my_App_Exception("Error executing query.\nInfo:\n" . print_r($pdo->errorInfo(), true)); 
    }
    .
    .
    .
    return $a_value;
}
  • 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-06-11T02:36:04+00:00Added an answer on June 11, 2026 at 2:36 am

    I found that the reason for this error was because there was a tcp connection timeout. I still can’t really explain myself why it timeouts even if the query are actually pretty short, but I managed to fix my problem by modifiying /etc/sysctl.conf and setting higher values for the keepalives. Of course, I know that the real solution will be to read each of the queries, and try to optimize those 🙂

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

Sidebar

Related Questions

I have run into this problem a few times and I'm not happy with
I have a PHP script that works by calling items from a database based
I have an R script that runs just fine when I run it from
I have a php script that loads data from a database. The table I
I have a php script run as a cron job that executes a set
I have this problem when I run SAS 9.2 on the command line on
I have this problem when trying to run hello world program using android SDK.
NOTE: I have solved the majority of this problem but have run into a
I run into this problem. I have a textarea which I only want to
I have a problem: if i run this test in NUnit ,it works Board

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.