Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Mon Jun 29, 2015 12:21 pm 
Offline
Newbie

Joined: Mon Jun 29, 2015 12:05 pm
Posts: 2
Hi

I'm sorry for this newbie question, beceause I'm new to the Linux, and I did a search on the forum, but maybe my keyword was not exact so that I wasn't found any tips I wish.

Today I received the following error message when I visit my wordpress website

Code:
Warning: mysqli_real_connect(): (HY000/2002): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /..../wp-includes/wp-db.php on line 1444

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

Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /..../wp-includes/wp-db.php on line 1474


I restarted the server, and now the website is working fine, however, I don't understand what's mean about the errors, so I opened a ticket and received the following reply:

Quote:
Your Linode was OOMing, meaning something inside your node is consuming all of the available virtual memory. You can see this for yourself by logging into Lish and viewing the output of the "logview" command within the console [0].

These messages you see written to your console indicate that your Linode had exhausted its allotted RAM resources and invoked the OOM-Killer. The OOM-Killer is designed to identify the highest scoring processes and kill them in order to free up memory required by the system.

When you rebooted your Linode, it came back online - however, you will want to take measures to optimize your services to reduce your overall RAM and swap usage. To begin with, I'd suggest implementing the low-memory settings advised in our Troubleshooting guide to minimize your risks of OOMing again [1].


But I don't know why when I enter "logview" command, it shows "logview: command not found", so how can I find out the process which is consuming all of the available virtual memory?

Thanks


Top
   
PostPosted: Mon Jun 29, 2015 2:02 pm 
Offline
Senior Member

Joined: Fri Feb 13, 2015 8:12 pm
Posts: 101
The process which is taking all your memory is almost always Apache in prefork mode using mod-php. (You can use the "top" command to check, then press capital M).

Try switching to Nginx + PHP-FPM. See the thread below this one:

https://forum.linode.com/viewtopic.php?f=20&t=11978


Top
   
PostPosted: Mon Jun 29, 2015 4:19 pm 
Offline
Newbie

Joined: Mon Jun 29, 2015 12:05 pm
Posts: 2
sanvila wrote:
The process which is taking all your memory is almost always Apache in prefork mode using mod-php. (You can use the "top" command to check, then press capital M).

Try switching to Nginx + PHP-FPM. See the thread below this one:

https://forum.linode.com/viewtopic.php?f=20&t=11978


Thanks for your reply, is there any way to improve the server configuration without switching to Nginx, because I don't want to make website offline, I don't have secondary hosting.


Top
   
PostPosted: Mon Jun 29, 2015 4:48 pm 
Offline
Senior Member

Joined: Fri Feb 13, 2015 8:12 pm
Posts: 101
If your Apache is >= 2.4, you can use Apache + PHP-FPM, and it would also be an improvement over your current setup.

The offline time depends on how fast you can change the configuration and restart Apache.

If you use a little bit of scripting, it should not take more than a few seconds, a minute at most.
Use a test linode to experiment.


Top
   
PostPosted: Wed Jul 01, 2015 10:36 pm 
Offline
Senior Member

Joined: Fri Jan 09, 2009 5:32 pm
Posts: 634
johnnywoo wrote:
sanvila wrote:
The process which is taking all your memory is almost always Apache in prefork mode using mod-php. (You can use the "top" command to check, then press capital M).

Try switching to Nginx + PHP-FPM. See the thread below this one:

https://forum.linode.com/viewtopic.php?f=20&t=11978


Thanks for your reply, is there any way to improve the server configuration without switching to Nginx, because I don't want to make website offline, I don't have secondary hosting.


Do a search in this forum for MaxClients, this question is asked very frequently. Simple answer is to try dropping your MaxClients to 30, possibly lower. The default is *way* too high


Top
   
PostPosted: Thu Jul 02, 2015 8:05 pm 
Offline
Senior Member

Joined: Thu Feb 20, 2014 5:06 pm
Posts: 58
sanvila wrote:
If your Apache is >= 2.4, you can use Apache + PHP-FPM, and it would also be an improvement over your current setup.

The offline time depends on how fast you can change the configuration and restart Apache.

If you use a little bit of scripting, it should not take more than a few seconds, a minute at most.
Use a test linode to experiment.


You don't need Apache 2.4+. I'm using Apache 2.2.15 with the worker MPM and PHP-FPM, and it works great.

Switching to Nginx is probably not worth it. Just switch to the worker or event MPM instead of prefork.


Top
   
PostPosted: Fri Jul 03, 2015 4:40 am 
Offline
Senior Member

Joined: Fri Feb 13, 2015 8:12 pm
Posts: 101
Ok, you don't need Apache 2.4, but then you will need some "extras".

Apache 2.4 is the first release where you do not need any "extras".
https://wiki.apache.org/httpd/PHP-FPM
Quote:
we can now run secure, fast, and dependable PHP code using only the stock apache httpd and php.net releases; no more messing around with suphp or suexec - or, indeed, mod_php.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group