MariaDb suddenly stops.

it happened yesterday and today as well when i opened my website it showed “error establishing a database connection”, then to check up on services i opened cyberpanel login and there it says " Server error (500)" tho there was 80% of free ram… so i checked up my running tasks using console and saw mysqlid wasn’t running so i typed “systemctl start mariadb” to start the mariadb and the problem was solved but again today it happened.

i can’t figure out what went wrong ram usage was fine the whole day so it can’t be ram.

some php errors

/home/web.com/public_html/wp-includes/wp-db.php on line 1924
2018-09-08 18:43:27.074738 [NOTICE] [108.162.238.148:26546] [STDERR] PHP Warning: mysqli_query(): MySQL server has gone away in /home/web.com/public_html/wp-includes/wp-db.php on line 1924
2018-09-08 18:43:27.074790 [NOTICE] [108.162.238.148:26546] [STDERR] PHP Warning: mysqli_query(): Error reading result set’s header in /home/web.com/public_html/wp-includes/wp-db.php on line 1924
2018-09-08 18:43:27.074803 [NOTICE] [108.162.238.100:14648] [STDERR] PHP Warning: mysqli_query(): MySQL server has gone away in /home/web.com/public_html/wp-includes/wp-db.php on line 1924
2018-09-08 18:43:27.074809 [NOTICE] [108.162.238.100:14648] [STDERR] PHP Warning: mysqli_query(): Error reading result set’s header in /home/web.com/public_html/wp-includes/wp-db.php on line 1924
2018-09-08 18:43:27.074819 [NOTICE] [108.162.238.100:14682] [STDERR] PHP Warning: mysqli_query(): MySQL server has gone away in /home/web.com/public_html/wp-includes/wp-db.php on line 1924
2018-09-08 18:43:27.074824 [NOTICE] [108.162.238.100:14682] [STDERR] PHP Warning: mysqli_query(): Error reading result set’s header in /home/web.com/public_html/wp-includes/wp-db.php on line 1924
2018-09-08 18:43:27.154650 [NOTICE] [108.162.238.148:26540] [STDERR] PHP Warning: mysqli_query(): MySQL server has gone away in /home/web.com/public_html/wp-includes/wp-db.php on line 1924
2018-09-08 18:43:27.154672 [NOTICE] [108.162.238.148:26540] [STDERR] PHP Warning: mysqli_query(): Error reading result set’s header in /home/web.com/public_html/wp-includes/wp-db.php on line 1924
2018-09-08 18:43:27.186679 [NOTICE] [162.158.186.173:39238] [STDERR] PHP Warning: Error while sending QUERY packet. PID=474 in /home/web.com/public_html/wp-includes/wp-db.php on line 1924
2018-09-08 18:43:27.194379 [NOTICE] [162.158.187.18:45084] [STDERR] PHP Warning: Error while sending QUERY packet. PID=500 in /home/web.com/public_html/wp-includes/wp-db.php on line 1924

How much ram do you have? And what is the output of

cat /etc/my.cnf

i have 2 GB ram and the output is

This group is read both both by the client and the server

use it for options that affect everything

[client-server]

include all files from the config directory

!includedir /etc/my.cnf.d

Take a look at this guide and tweak MySQL How do I fix the error "Mysql Server has gone away"? FAQ - Analytics Platform - Matomo

Take a look at this guide and tweak MySQL https://matomo.org/faq/troubleshooting/faq_183/

is this referring to ddos? "Server dropped an incorrect or too large packet. If mysqld gets a packet that is too large or incorrect, it assumes that something has gone wrong with the client and closes the connection. To fix, you can increase the maximal packet size limit "

should i increase the limit?

Yes increase the limit, see if your issue is resolved.

Yes increase the limit, see if your issue is resolved.

back again, it’s not resolved now it’s happening twice a day i don’t think it’s the ram thats causing it.
how can i check my logs after it crashes?

lsphp - 336.82mb what is lsphp? and it keeps going up and down.

htop: Imgur: The magic of the Internet