MySQL said: A connection attempt failed because ... MySQL said: A connection attempt failed because ...
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

MySQL said: A connection attempt failed because ...

Started by FredNexus, September 11, 2016, 12:15:05 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

FredNexus

Hello,

I have a small MYSQL problem with Coppermine.

Sometimes when I load a coppermine page on my local server XAMPP, Coppermine return this error

MySQL said: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

This error is random, everything can perfectly works few hours and then from nowhere I have this error every 2 or 5 minutes. :o

This happens only with Coppermine. I have installed on my local server some Prestashop, Wordpress or PHPBB and they works perfectly. They never report any MYSQL issue.

I try to change the XAMPP version, one with 2.2.21, PHP 5.3.8 & MYSQL 5.5.16, an other with Apache 2.4.18, PHP 5.5.35 & MariaDB 10.1.13, but I have the same
error message.

I search on google and most of the solution indicate a PHP version problem and to resolve it to change 'localhost' for '127.0.0.1' in the php virtualhost and the windows host file.

I try it with no change at all. :(

Somebody have an idea about it ??

This is a translation of my previous message about this problem on the french section. http://forum.coppermine-gallery.net/index.php?topic=78801.0

Configuration :
Windows 7 X64 / 32GB ram
XAMPP 5.5.35
   Apache 2.4.18
   PHP 5.5.35
   MariaDB 10.1.13

Coppermine 1.5.42
   Default install

Thanks

Best regards

Nexus

Αndré

I think your MySQL server is quite busy and thus not able to handle the request when the error message appear. Try if connecting to the database with another application is possible at the same time.

You could also try to create a copy of your gallery and upgrade it to cpg1.6.x (still under development and not released, just for testing purposes). Maybe it's related to the deprecated "mysql_connect" function. You can download it here: https://github.com/coppermine-gallery/cpg1.6.x/archive/develop.zip

FredNexus

I don't think my MSQL server is too busy, it's a dev server and I'm the only one to use it  ;D

But I'm pretty sure something is not well configured in my XAMPP, unfortunately I'm not a web admin ...  ::)

I will try this weekend the cpg1.6.x

Thanks
Best Regards

FredNexus

I test cpg1.6.x  :o

If i just swap the php files it's working but very very slow. :-\

On a new fresh install it's better.

I try to works on my plugin with 1.6 and I do not had the connection message so far but 1.6 I have some MYQL problem now  ::)

For example

$result_id = cpg_db_query("SELECT MAX(id) as MaximumID FROM {$CONFIG['MYTABLE']}");

It's not working.

print_r of $result_id =

CPG_DbaseResult Object
(
    [qresult:protected] => mysqli_result Object
        (
            [current_field] => 0
            [field_count] => 1
            [lengths] =>
            [num_rows] => 1
            [type] => 0
        )

)


On 1.5
Resource id #55

Sure the result on 1.6 is more understandable but empty !!  ;D


Αndré

We're going off-topic. But why do you think your code isn't working? Have you actually tried to get the result of your query? Try
$result_id = cpg_db_query("SELECT MAX(id) as MaximumID FROM {$CONFIG['MYTABLE']}");
$result = cpg_db_result($result_id);
print_r($result);

FredNexus

Yes we are off topic !!

I un-install the 1.6 version but the result was empty.

I will retry.  :)

gmc

CPG_DbaseResult Object
(
    [qresult:protected] => mysqli_result Object
        (
            [current_field] => 0
            [field_count] => 1
            [lengths] =>
            [num_rows] => 1
            [type] => 0
        )

)


This does NOT indicate an empty result set... You printed the Database result OBJECT (print_r of $result_id) rather than OBTAINING the result FROM the OBJECT - and printing that...
(which is why André suggested adding the call to cpg_db_result - and then printing the actual result...

Reading the object info above - it indicates current cursor is at field 0 (never been accessed yet)... there is one field in one row - exactly the reply I would expect from the query.


In CPG 1.5 - the database method was different - but again the print only indicated it was a valid resource id - still need to retrieve the result from the resource to print it.
Thanks!
Greg
My Coppermine Gallery
Need a web hosting account? See my gallery for an offer for CPG Forum users.
Send me money

FredNexus

I retry with  "cpg_db_result"  and it's work well. ;D

thx


Αndré

Fine. But does cpg1.6.x also fix your initial issue?

FredNexus

Sorry for the delay.

It's fix my mysql issue but it's so slow

Ex: the homepage 26sec to load ...

I think I have a problem with my XAMPP config.