Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: MySQL said: A connection attempt failed because ...  (Read 8632 times)

0 Members and 1 Guest are viewing this topic.

FredNexus

  • Coppermine newbie
  • Offline Offline
  • Posts: 16
MySQL said: A connection attempt failed because ...
« on: September 11, 2016, 12:15:05 pm »

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
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: MySQL said: A connection attempt failed because ...
« Reply #1 on: September 13, 2016, 10:07:19 am »

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
Logged

FredNexus

  • Coppermine newbie
  • Offline Offline
  • Posts: 16
Re: MySQL said: A connection attempt failed because ...
« Reply #2 on: September 14, 2016, 07:48:08 pm »

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
Logged

FredNexus

  • Coppermine newbie
  • Offline Offline
  • Posts: 16
Re: MySQL said: A connection attempt failed because ...
« Reply #3 on: September 19, 2016, 07:58:48 pm »

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

Code: [Select]
$result_id = cpg_db_query("SELECT MAX(id) as MaximumID FROM {$CONFIG['MYTABLE']}");
It's not working.

print_r of $result_id =

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

)

On 1.5
Code: [Select]
Resource id #55
Sure the result on 1.6 is more understandable but empty !!  ;D

Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: MySQL said: A connection attempt failed because ...
« Reply #4 on: September 19, 2016, 08:13:25 pm »

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
Code: [Select]
$result_id = cpg_db_query("SELECT MAX(id) as MaximumID FROM {$CONFIG['MYTABLE']}");
$result = cpg_db_result($result_id);
print_r($result);
Logged

FredNexus

  • Coppermine newbie
  • Offline Offline
  • Posts: 16
Re: MySQL said: A connection attempt failed because ...
« Reply #5 on: September 20, 2016, 11:39:11 am »

Yes we are off topic !!

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

I will retry.  :)
Logged

gmc

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 785
    • GMC Design Photo Gallery
Re: MySQL said: A connection attempt failed because ...
« Reply #6 on: September 22, 2016, 03:10:22 am »

Code: [Select]
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.
Logged
Thanks!
Greg
My Coppermine Gallery
Need a web hosting account? See my gallery for an offer for CPG Forum users.
Send me money

FredNexus

  • Coppermine newbie
  • Offline Offline
  • Posts: 16
Re: MySQL said: A connection attempt failed because ...
« Reply #7 on: September 28, 2016, 11:08:56 am »

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

thx

Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: MySQL said: A connection attempt failed because ...
« Reply #8 on: September 28, 2016, 03:09:15 pm »

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

FredNexus

  • Coppermine newbie
  • Offline Offline
  • Posts: 16
Re: MySQL said: A connection attempt failed because ...
« Reply #9 on: October 04, 2016, 05:56:35 pm »

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.

Logged
Pages: [1]   Go Up
 

Page created in 0.024 seconds with 20 queries.