add httpd status out put (if you use cpanel ) and what about internet conecction, you have a 10 mbits port 100mbits port or 1gbit, and what about usage check it whit iptraf, and you have 4.5 % of IO WAIT on screan shot, maybe a slow disk is a problem, you dont have raid, online one 7200 rpm disk, that is slow for a server.
–
SkamasleJan 4 '14 at 5:02

Yea I was also thinking that also, but I guess if I can minimise any hardware upgrade expense, it would help immensely. I have a dedicated 100mbit port.
–
MoeJan 4 '14 at 7:28

Is phpmyadmin running on the same server but in a different VirtualHost directive? If so, then likely there is something in the website's VirtualHost (or .htaccess?) causing the problem (eg allow/deny using a hostname and you have a slow ip lookup). Could also be a user.ini file for your website directory causing weird php startup issues.
–
DerfKJan 4 '14 at 16:13

2 Answers
2

I think your problem is simply your hard disk with it's access times. Apache can cache html-pages in memory, but php-scripts are not cached; the need to be executed every time again. Therefore the php interpreter is called and it reads the script from the hdd. This takes a lot of time. The most slowest thing on your server is your HDD. On my pc, there is an extreme difference between applications starting from my SSD and my HDD (the SSD is up to 10 times faster!). If your HDD works, then the latency for executing an php script may increase drastically.

Possible solutions: get an SSD (maybe a small one just for often accessed data such as scripts) and minimize script calls (and HDD accesses) on your server. Make sure, the filesystem is defragmented (usually done automatically). If your php-script creates often the same contents, try caching them into an html file.

Thanks for this. I installed APC with little to no improvement. Upon the recommendation of the next answer, I installed varnish cache. I was skeptical at first, and setting it up wasn't as straight forward as the tutorials made it out to be. But once I got it working. Wow. My server is now a rocket and my server load rarely passes 1! Madness!
–
MoeJan 5 '14 at 11:22

HTML file you're testing is just a plain file, all that Apache has to do is do a few system calls (open, read) and then serve its content.

PHP OTOH is actually quite a "heavy" option: it's an entire interpreter (bytecode compiler?). And since you're using concurrent testing (-c) who knows how well the requests are multiplexed to it? This does not have to be apache problem at all, but rather PHP's problem.

What I'd do:

Switch to Apache MPM (multi-threaded in multiple processes).

Do sequential test (no multiple concurrent requests), compare.

Run valgrind or some such on apache process and see where most CPU time is spent (apache or PHP).

run the same test but serving this page via nginx. Since nginx is based on async model and very fast, then if you get similar results, PHP is the culprit.

Really, comparing serving a static file to dynamically generated webpage is sort of apples to oranges comparison. None of the typical solutions (Python mod-apache, Django, PHP, etc) are going to be very fast in this regard, at least when compared to serving a static file. Node.js is an exception perhaps, due to sort of "low level" programming webpage directly in async model.