Jump to content

Recommended Posts

Posted

Hi,

Often I get for some seconds the error "Database connection error" in WordPress on frontend and backend. How can I solve it?

I've already tried the WP database repair and optimization and the editing of wp-config.php file.

Thanks

Posted (edited)

That error could mean a lot of things. Is there any more informative error in your error_log file?

I think this is the cause:

 

[14-Oct-2017 20:24:48 UTC] PHP Deprecated:  Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version. To avoid this warning set 'always_populate_raw_post_data' to '-1' in php.ini and use the php://input stream instead. in Unknown on line 0

Or mabye this one:

[15-Oct-2017 11:24:31 UTC] PHP Warning:  file_put_contents(/home/maicol07/public_html/books/wp-content/cache/autoptimize/css/autoptimize_57cab31e8f9c93cab2c32fad337adf53.css): failed to open stream: No such file or directory in /home/maicol07/public_html/books/wp-content/plugins/autoptimize/classes/autoptimizeCache.php on line 59
Edited by maicol07
Posted

Neither of those are database errors though. The top one is just a warning, but the code should still execute fine for now. It's just letting you know that when php is upgraded it will probably stop working. The second error is just some plugin of yours complaining about not being able to write to a file. It's not a database issue either.

 

I took a look at your error_log and I found this

[15-Oct-2017 12:59:05 UTC] WordPress errore sul database Table 'maicol07_wpmk.wp_datalist' doesn't exist per la query SELECT count(*) FROM `wp_datalist` WHERE `url` = "/wp-cron.php?doing_wp_cron=1508072344.5565590858459472656250" fatta da require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), include('/themes/Gameleon/functions.php')
That's a database error and it looks like your wordpress database is missing a table. Not sure how that would have happened.
Posted

Strange... it's another website hosted in my account that uses another database... I'll look into it!

Posted

Wow, that is a really bloated wordpress install. It takes forever to load even though it's on our fastest server, and the load is low. It also takes an inordinate amount of memory. Do you have a lot of plugins installed perhaps? Anyways, after trying to view that page some idea: It might be a 500 error because the page is so slow that the php processes get killed to to execution time limit. It could also be a memory limit you're hitting. It could be a lot of other things too though. I'm not very familiar with wordpress but does it log these types of errors anywhere? I don't see an error_log like your other wordpress install.

Posted (edited)

Yes, I have a lot of plugins, but they are necessary for me... Also I don't know if WP log these errors...

Also now I can't access to the WP Admin area doesn't work... It says me the page has redirected too many times...

Edited by maicol07
Posted

It says me the page has redirected too many times...

You need to clear your browser cache...

 

I think it may be time to start writing an article on how to migrate away from wordpress to Hugo/Jekyll as it seems that a few Helio members still use Wordpress when there is usually no need of it...

 

We should look into having Hugo/Github-jekyll on our production servers at a later point, this could simplify the process a lot (i.e: daily Cron jobs to build the site from the source hosted on the server.)

Posted

WordPress is one of if not the worst written, bug and vulnerability-filled CMS software out there. Abject junk. Seriously, just about any other CMS or website generator out there is going to do a better job. All of us here highly recommend you just replace your WP install instead of trying to fix it. You won't have to deal with these errors anymore, the site will be faster, and it will be more secure too.

 

 


I think it may be time to start writing an article on how to migrate away from wordpress to Hugo/Jekyll as it seems that a few Helio members still use Wordpress when there is usually no need of it...

 

That'd be quite useful. A lot of the WP sites I've seen on here are indeed in this category. Rarely updated static content. Definitely no need for the bloat and risks of WP. The ones that don't are usually either crude stores built with a WP plugin (a proper ecommerce system would be better suited for that), or content/news aggregation sites of some form.

 

Can Hugo do basic interactive elements like a contact form? I haven't had time to look into it more...

Posted (edited)

Wow, that is a really bloated wordpress install. It takes forever to load even though it's on our fastest server, and the load is low. It also takes an inordinate amount of memory. Do you have a lot of plugins installed perhaps? Anyways, after trying to view that page some idea: It might be a 500 error because the page is so slow that the php processes get killed to to execution time limit. It could also be a memory limit you're hitting. It could be a lot of other things too though. I'm not very familiar with wordpress but does it log these types of errors anywhere? I don't see an error_log like your other wordpress install.

Regarding your question @Krydos, I managed to found a way to store WP logs. WP has a built-in disabled function that allow to store all the PHP errors/results that aren't in the error_log files. I enabled it and this is the output:

[21-Oct-2017 13:16:16 UTC] PHP Notice:  Trying to get property of non-object in /home/maicol07/public_html/books/wp-includes/class-wp-query.php on line 3760
[21-Oct-2017 13:16:16 UTC] PHP Notice:  Trying to get property of non-object in /home/maicol07/public_html/books/wp-includes/class-wp-query.php on line 3762
[21-Oct-2017 13:16:16 UTC] PHP Notice:  Trying to get property of non-object in /home/maicol07/public_html/books/wp-includes/class-wp-query.php on line 3764
[21-Oct-2017 13:16:16 UTC] PHP Notice:  Trying to get property of non-object in /home/maicol07/public_html/books/wp-includes/class-wp-query.php on line 3760
[21-Oct-2017 13:16:16 UTC] PHP Notice:  Trying to get property of non-object in /home/maicol07/public_html/books/wp-includes/class-wp-query.php on line 3762
[21-Oct-2017 13:16:16 UTC] PHP Notice:  Trying to get property of non-object in /home/maicol07/public_html/books/wp-includes/class-wp-query.php on line 3764
[21-Oct-2017 13:16:16 UTC] PHP Notice:  Use of undefined constant W3TC_POWERED_BY - assumed 'W3TC_POWERED_BY' in /home/maicol07/public_html/books/wp-content/plugins/google-webfont-optimizer/google-webfont-optimizer.php on line 342
[21-Oct-2017 13:16:16 UTC] PHP Notice:  Use of undefined constant W3TC_POWERED_BY - assumed 'W3TC_POWERED_BY' in /home/maicol07/public_html/books/wp-content/plugins/google-webfont-optimizer/google-webfont-optimizer.php on line 342
[21-Oct-2017 13:16:16 UTC] PHP Notice:  ob_end_flush(): failed to delete and flush buffer. No buffer to delete or flush in /home/maicol07/public_html/books/wp-content/plugins/google-webfont-optimizer/google-webfont-optimizer.php on line 372
[21-Oct-2017 13:16:17 UTC] PHP Notice:  is_page was called <strong>incorrectly</strong>. Conditional query tags do not work before the query is run. Before then, they always return false. Please see <a href="https://codex.wordpress.org/Debugging_in_WordPress">Debugging in WordPress</a> for more information. (This message was added in version 3.1.0.) in /home/maicol07/public_html/books/wp-includes/functions.php on line 4139
[21-Oct-2017 13:16:17 UTC] PHP Notice:  is_singular was called <strong>incorrectly</strong>. Conditional query tags do not work before the query is run. Before then, they always return false. Please see <a href="https://codex.wordpress.org/Debugging_in_WordPress">Debugging in WordPress</a> for more information. (This message was added in version 3.1.0.) in /home/maicol07/public_html/books/wp-includes/functions.php on line 4139
[21-Oct-2017 13:16:17 UTC] PHP Notice:  is_page was called <strong>incorrectly</strong>. Conditional query tags do not work before the query is run. Before then, they always return false. Please see <a href="https://codex.wordpress.org/Debugging_in_WordPress">Debugging in WordPress</a> for more information. (This message was added in version 3.1.0.) in /home/maicol07/public_html/books/wp-includes/functions.php on line 4139
[21-Oct-2017 13:16:17 UTC] PHP Notice:  Trying to get property of non-object in /home/maicol07/public_html/books/wp-includes/class-wp-query.php on line 3760
[21-Oct-2017 13:16:17 UTC] PHP Notice:  Trying to get property of non-object in /home/maicol07/public_html/books/wp-includes/class-wp-query.php on line 3762
[21-Oct-2017 13:16:17 UTC] PHP Notice:  Trying to get property of non-object in /home/maicol07/public_html/books/wp-includes/class-wp-query.php on line 3764
[21-Oct-2017 13:16:17 UTC] PHP Notice:  Trying to get property of non-object in /home/maicol07/public_html/books/wp-includes/class-wp-query.php on line 3760
[21-Oct-2017 13:16:17 UTC] PHP Notice:  Trying to get property of non-object in /home/maicol07/public_html/books/wp-includes/class-wp-query.php on line 3762
[21-Oct-2017 13:16:17 UTC] PHP Notice:  Trying to get property of non-object in /home/maicol07/public_html/books/wp-includes/class-wp-query.php on line 3764
[21-Oct-2017 13:16:18 UTC] PHP Notice:  Use of undefined constant W3TC_POWERED_BY - assumed 'W3TC_POWERED_BY' in /home/maicol07/public_html/books/wp-content/plugins/google-webfont-optimizer/google-webfont-optimizer.php on line 342
[21-Oct-2017 13:16:18 UTC] PHP Notice:  WC_Cart::get_cart_url è <strong>deprecata</strong> dalla versione 2.5! Utilizzare al suo posto wc_get_cart_url. in /home/maicol07/public_html/books/wp-includes/functions.php on line 3831
[21-Oct-2017 13:16:18 UTC] PHP Notice:  Trying to get property of non-object in /home/maicol07/public_html/books/wp-content/plugins/google-webfont-optimizer/google-webfont-optimizer.php on line 69
[21-Oct-2017 13:16:18 UTC] PHP Notice:  Use of undefined constant W3TC_POWERED_BY - assumed 'W3TC_POWERED_BY' in /home/maicol07/public_html/books/wp-content/plugins/google-webfont-optimizer/google-webfont-optimizer.php on line 342
[21-Oct-2017 13:16:18 UTC] PHP Notice:  ob_end_flush(): failed to delete and flush buffer. No buffer to delete or flush in /home/maicol07/public_html/books/wp-content/plugins/google-webfont-optimizer/google-webfont-optimizer.php on line 372

Also, in the admin page, when the database connection error occurs, it prints:

Warning: mysqli_real_connect(): (HY000/1203): User maicol07_wp896 already has more than 'max_user_connections' active connections in /home/maicol07/public_html/books/wp-includes/wp-db.php on line 1548

Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/maicol07/public_html/books/wp-includes/wp-db.php on line 1578

Warning: mysql_connect(): User maicol07_wp896 already has more than 'max_user_connections' active connections in /home/maicol07/public_html/books/wp-includes/wp-db.php on line 1578

Should I change PHP version to an older one?

Thanks

Edited by maicol07
Posted

Your logs are basically saying that your WP is broken, try reinstalling it through cPanel Softaculous as this allows you to select the database you want to use as well because Im also seeing a database connection error!

 

I would delete everything, then make sure it works by visiting your admin panel, probably, /wp-admin/, then add all of your plugins one by one to see if a plugin you are using is broken or causing your website to break...

Posted (edited)

Can Hugo do basic interactive elements like a contact form? I haven't had time to look into it more...

 

Hugo (&jekyll) aims to be fully static, so most or all dynamic features are hosted by third parties (implemented via JS), Like https://disqus.com/ for comments.

And according to the discourse: https://discourse.gohugo.io/t/is-it-possible-to-add-a-contact-form-to-a-site/1550/2 https://formkeep.com/ or formspree is recommended for forms (I haven't tried it, but it seems quite simple.)

Edited by miwilc

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...