Site is occasionally very slow

My website ( is running wordpress 3.5, with a custom theme and a heavily modified plugin. Up until a half a year ago it always used to run smoothly, but recently every 10 days or so, it goes through a 2-3 days phase of extreme slowness. It may even take a minute to load each page and some times it fails all together.
Other subdomains, sites(wordpress, dokuwiki, coordino) as well as direct file access on the same server (jped from within the wordpress media repository) load at normal speeds.
Traffic rarely exceeds 100 hits a day and a couple of hundred mb of daily bandwidth.
I login to the server the other day while the site was running slow and noticed that there are a bunch of php5.cgi procs running, even if there was currently no-one on the site (according to google analytics). A couple of those were even .

Do you have any ideas of what may be causing this slowness?
I kind of doubt it’s my plugin, as the site is still slow when I deactivate it, or at pages which don’t load any of shortcodes.

thank you

List of the plugins I am using:
Contact Form 7
Contact Form 7 reCAPTCHA extension
Google Analytics for WordPress
Limit Login Attempts
NextGEN Gallery (modified a lot)
Really Simple CAPTCHA

top capture:
Cpu(s): 32.5%us, 2.9%sy, 15.3%ni, 48.3%id, 0.8%wa, 0.0%hi, 0.3%si, 0.0%st
Mem: 16434432k total, 14785076k used, 1649356k free, 692444k buffers
Swap: 3998716k total, 309100k used, 3689616k free, 5861264k cached

19525 ch3 20 0 0 0 0 Z 0 0.0 0:01.08 php5.cgi
20881 ch3 20 0 0 0 0 Z 0 0.0 0:00.94 php5.cgi
22057 ch3 20 0 0 0 0 Z 0 0.0 0:00.90 php5.cgi
22347 ch3 20 0 183m 37m 8016 D 0 0.2 0:00.90 php5.cgi
22588 ch3 20 0 148m 37m 8016 D 0 0.2 0:00.89 php5.cgi
22967 ch3 20 0 197m 37m 8012 D 0 0.2 0:00.85 php5.cgi
23345 ch3 22 2 79204 1636 912 S 0 0.0 0:00.00 sshd
23346 ch3 22 2 155m 1920 1424 S 0 0.0 0:00.01 bash
23355 ch3 22 2 24808 1208 924 R 0 0.0 0:00.04 top
23431 ch3 20 0 197m 29m 220 R 0 0.2 0:00.00 php5.cgi
23433 ch3 20 0 148m 29m 220 R 0 0.2 0:00.00 php5.cgi
23514 ch3 20 0 183m 29m 220 R 0 0.2 0:00.00 php5.cgi

Well you’re on PHP 4… Which actually shouldn’t even work. o.O

Change that to PHP 5.3 Fast CGI.

why do you say I am on php4?
phpInfo says Version 5.2.17

and even if it isn’t, do I have privileges to change the version?

The output from top suggests php 5.2 as well.

You might have been getting some bot activity that analytics disregards or something. Is it still slow?

Panel’s showing PHP 4. Which usually means you have some disconnect in info (manual PHP install?). I would switch it in Panel if you don’t need a custom install.

I haven’t installed the php my self, I thought it comes with the hosting, or maybe my brother did who is paying for it.
I submitted a ticket as well and the support told me one of my php scipt is using too much ram and their daemons are killing the processes to balance the load on the server. I hope they will be able to give me more detailed logs so I can pin point which aspect of the site is causing this problem.

The site went back to normal for a day or two after the support replied to me, but it’s now slow again.

Take a look in the logs available to you (access.log and error.log) to see if there’s any unaccounted background activity as well.