mysql error: [2006: MySQL server has gone away]

Permalink 1 user found helpful
Hi Guys

We are experiencing mysql error: [2006: MySQL server has gone away] very rarely on one of our sites but see this as a major issue regardless.

After looking at posts in the forum they all point to speaking to the host to get more help.

I have spoken to the web host and they will not change any " wait_timeout" or "max_allowed_packet" due to the shared environment.

Hosts answer was to optimize the scripts, unfortunately I am no coder and it happens so randomly, within the site and randomly in the dashboard that I could not pin point this, I know it has happened whilst using easynews and also going to the page with this block on it, but has also happens on the homepage where I have power slider and content blocks so its very random.

Any ideas/help would be appreciated as this is the first time it has happened. I am not sure what to do from here.

I look forward to a response.

bmsdigital

reachdigital
View Replies:
Mnkras replied on at Permalink Reply
Mnkras
That is a host issue, that really doesn't have much to do with c5 at all, I would recommend a new host.
reachdigital replied on at Permalink Reply
reachdigital
Thank you Mnkras,

I have another site on that host and works no problem and so we specifically directed the customer to this service being in Australia, due to C5 working perfectly.

Could it be the c5 version we are on # concrete5 Version 5.4.2.1 and having issues with our auto update which c5 saying its up to date already and cnat go to 5.4.2.2

Are there any optimized c5 setting I should follow, which will ensure Im using the best settings an so on? Both in dashboard and any core files?

For example I have the Development PHP errors and database exceptions will be displayed ON. Should I change to production?

I look forward to your response.
Mainio replied on at Permalink Reply
Mainio
If you're looking to boost your performance, I'd strongly suggest using cache library. Either memcached or APC, depending on what's installed on your host. At least that would make concrete5 do less database calls as it could load more data straight from the cache.

Here are few tips by Andrew:
http://andrewembler.com/posts/5-easy-ways-to-speed-up-a-concrete5-s...

And if your host doesn't have memcached or APC installed, you can try this:
http://andrewembler.com/posts/improving-the-performance-of-zend-cac...

But, that doesn't get you away from the fact that database calls are still needed when the cache is cleared or cache is expired. But it might make those errors happen more rarely.

Changing the error display settings does not give you performance boost as far as I know. But it would of course be suggested not to show your visitors those errors in production.


Antti / Mainio
reachdigital replied on at Permalink Reply
reachdigital
Thank you Antti / Mainio

I will have a look at this also, I'm trying to enable "memcached" but caused some fatal errors which I have pointed out in a previous response to Mesuva, Im hoping to get more insight and hopefully get it to work with memcached enabled.

Any tips let me know :)

Thanking you in advance.

bmsdigital
mesuva replied on at Permalink Reply
mesuva
Mainio's points about turning on a cache library are what I would suggest to reduce the database load, so give that a go.

If you still having trouble and feel the need to migrate please feel free to PM me if you need a recommendation for an Australian web host that handles concrete5 very well (also having memcached available, making it pretty quick for shared hosting).

I've lost count of the number of Australian hosts I've installed sites to, but I could count on one hand the number that I've actually found to be reliable, set up well and fast.
AngusHume replied on at Permalink Reply
AngusHume
We use Webcity for our own static website and a few small static client websites. When I tried C5 install on there to test that error crops up constantly. Not rarely. They were not much help... never heard of C5 blah blah, can't change shared settings etc.

Just the same if I could optimise something at my end to get rid of them I'd give it a go.

Currently working on a larger site, which is hosted with Servers Australia. It's still shared hosting but about $20/m with about 100 sites rather than $6/m with 1000 sites. I've not had that error with them at all, but still get a massive lag producing a page sometimes - more than 10 seconds. I'll have to look over the tips posted.
mesuva replied on at Permalink Reply
mesuva
Since you have mentioned them, Servers Australia is who I use for most of my hosting, I've very happy with them.

In fact, your site is probably on the same server as my sites.
I've very rarely seen any lag with them and my page speeds tend to be under a second, across a range of concrete5 sites.

The key thing with that setup is to to chuck into /config/sites.php :

define('CACHE_LIBRARY', 'memcached');


and make sure normal block caching is turned on in the dashboard.
Since I've learnt I can do that, I've never had any speed concerns.

For a few sites, I've added my own caching system and it turns sites from pretty good into almost static speeds.
reachdigital replied on at Permalink Reply
reachdigital
Thank you for your response Mesuva ,

I am also hosting with Webcity so I'm glad we are on the same page.

I did the following define('CACHE_LIBRARY', 'memcached'); to the /config/site.php and caused this straight away:

Fatal error: Uncaught exception 'Zend_Cache_Exception' with message 'The memcache extension must be loaded for using this backend !' in /home/mysitexxxx/public_html/concrete/libraries/3rdparty/Zend/Cache.php:209 Stack trace: #0 /home/mysitexxxx/public_html/concrete/libraries/3rdparty/Zend/Cache/Backend/Memcached.php(123): Zend_Cache::throwException('The memcache ex...') #1 /home/mysitexxxx/public_html/concrete/libraries/3rdparty/Zend/Cache.php(153): Zend_Cache_Backend_Memcached->__construct(Array) #2 /home/mysitexxxx/public_html/concrete/libraries/3rdparty/Zend/Cache.php(94): Zend_Cache::_makeBackend('memcached', Array, false, false) #3 /home/mysitexxxx/public_html/concrete/libraries/cache.php(57): Zend_Cache::factory('Core', 'memcached', Array, Array, false, false) #4 /home/mysitexxxx/public_html/concrete/libraries/cache.php(64): Cache::getLibrary() #5 /home/mysitexxxx/public_html/concrete/dispatcher.php(27): Cache::startup() #6 /home/mysitexxxx/public_html/index.php(2): require('/home/mysitexxxx/...') #7 {main} thrown in/home/mysitexxxx/public_html/concrete/libraries/3rdparty/Zend/Cache.php on line 209


I also tried this
define('CACHE_BACKEND_OPTIONS', serialize($backendOptions)); as mentioned herehttp://www.concrete5.org/documentation/developers/system/caching/...
but it create d a warning breaking the site.


Warning: Invalid argument supplied for foreach() in /home/mysitexxxx/public_html/concrete/libraries/cache.php on line 40
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/mysitexxxx/public_html/concrete/libraries/cache.php:40) in /home/mysitexxxx/public_html/concrete/startup/session.php on line 22


Any ideas what I may be doing wrong?

Thanking you in advance!
mesuva replied on at Permalink Reply
mesuva
The Zend_Cache_Exception is simply because memcached isn't available on the server. Unless your host installs it, that won't work. (so don't worry about the cache_backend_options)

Instead of 'memcached', you could try 'apc' or 'xcache', but I think you would have to be lucky for one of those to be installed too.

Just to be clear, setting the CACHE_LIBRARY to something only works IF that caching facility is available on the server. That's why they aren't turned on by default.

One way to see if something is available is to create a php info file and search the output for any sections that indicate if a caching system is available.

You create a file, say, info.php and put in it:
<?php
phpinfo();
?>


Put that somewhere on your webspace and view it. I know memcache for example shows up in that as a section.
reachdigital replied on at Permalink Reply
reachdigital
Thank you Mesuva,

Yes I have php info file "memcache" is not there or any of the others?

It does state that This program makes use of the Zend Scripting Language Engine.

Any other ideas?
mesuva replied on at Permalink Reply
mesuva
If you can't enable a cacheing engine and you are continuing to get those MySQL server errors, then Mnkras's original suggestion to find a new host is the same one I would make.

My feeling is that even if you had no caching turned on, you still shouldn't be getting those mysql errors, it should just slow things down.
reachdigital replied on at Permalink Reply
reachdigital
Thank you Mesuva,

I have requested to see if we can get this turned on and hopefully it will help.

As mentioned I have another site running C5 with Webcity and no issues at all hence using it again.

I really do appreciate your time so far.

bmsdigital
AngusHume replied on at Permalink Reply
AngusHume
I saw that Zend_Cache_Exception error straight away too on my webcity test install. I'd assumed it was becuase the option was not installed at the server end. Glad to see that confirmed here. It would be nice to run C5 on a cheap service like webcity, it's been fine for our small static sites. But they are cheap, so I guess we get what we pay for. I've been contemplating converting our own site and several other to C5 but at this point I guess I would have to move hosting as well.

I made the change on my Servers Australia install and it feels faster. Thanks for the tips!
reachdigital replied on at Permalink Reply
reachdigital
Thank you my AngusHume,

Ill see how far I can get and let you know.

Is this who you havehttp://www.serversaustralia.com.au/...

Cheers

bmsdigital
AngusHume replied on at Permalink Reply
AngusHume
Yep, I got the business shared hosting for $20/m for the site I'm currently working on
http://www.serversaustralia.com.au/business-web-hosting.php...

I'd welcome you persisting with Webcity, I've found their support can be a bit mixed. But if you get them to change it I'll look at them again.
mesuva replied on at Permalink Reply
mesuva
I have a reseller account with Servers Australia, it's on the same server as the business plans. If you don't have overly large space requirements and are looking for something less expensive, feel free to PM/contact me. Happy to set up things quickly and offer support to get things up and running. I also monitor the sites I host through it.
reachdigital replied on at Permalink Reply
reachdigital
Thank you Mesuva,

I will be in touch!

bmsdigital
AngusHume replied on at Permalink Reply
AngusHume
Thanks mesuva, I'll definately keep that in mind.