2

I have installed php5 in ubuntu and WordPress. It can run after installed. But after few days I've found there are lots of process and occupied a lot of memories. I try to use

ps -aux | grep www-data 

and found about 30 processes like this.

www-data 5066 0.0 0.0 131664 780 ? S 16:20 0:00 /usr/sbin/php5-fpm --fpm-config /etc/php5/fpm/main.conf 

I tried to

kill -9 pid 

and it didn't work, more process appears again. So could you tell me how to kill them safely and I don't want to my vps' memory occupied by it.

0

2 Answers 2

1

and it didn't work, more process appears again

Really? While I'd expect more processes to appear the one you killed should go away.

If you want to stop all of these then shutdown the daemon, I don't know how it's configured on your machine, but here I'd do....

/etc/init.d/php-fpm stop 

But htat's not the way to fix the problem of "I've found there are lots of process and occupied a lot of memories". You should start by doing proper traffic analysis and profiling the code.

0

Try here, I think its the same problem :)

How to stop www-data's Apache processes?

"Apache running as www-data is the default in Debian Lenny. You might be confusing a single 'parent' apache process (running as root) with apache 'children' doing HTTP request processing (running as www-data). Both 'parent' and 'children' processes should look like they were started with /usr/sbin/apache2 -k start (when you ps aux | grep apache), and the only difference is the process owner.

To control init startup scripts you could use sudo sysv-rc-conf (sudo aptitude install sysv-rc-conf if you don't have it - it is just an easy curses-like Perl wrapper for init scripts)." -Chronos

So each process is child process dealing with http requests, if yo really want to kill them either kill the process with sudo kill PID or maybe /usr/sbin/apache2 -k stop.

Tom

4
  • There is also one process that belongs to root and not www-data. This one is needed to bind to port 80 but will not actually do anything else for safety reasons. Commented Nov 2, 2011 at 8:51
  • i do not want to stop nginx or apache ,just think the memory it used may be too large.could you give me a solution that can optimize it or let the memory it occupied be fewer? Commented Nov 2, 2011 at 9:56
  • Apache is never going to be super memory efficient. If you want to really minimize your memory usage, maybe use another web server such as lighttp lighttpd.net. If your hell-bent on streamlining Apache, maybe try wiki.joyent.com/display/gen/Tuning+Apache. Commented Nov 2, 2011 at 11:32
  • Also take not of the bottom of this page, soporte.ideasmultiples.com/…. Basically you can tune your Apache to have less spare children, this will save memory. Hope this helps :) Commented Nov 2, 2011 at 11:35

You must log in to answer this question.