i'm running a VPS with Linux CentOs 6 with 4 GB of RAM, 10 GB of HD and 2 virtual CPU Intel(R) Xeon(R)CPU L5640 @ 2.27GHz. As my host says each virtual CPU must be at least 0.5 physical cpu.
At certain times of the day, those with more traffic, trying accessing my php script i receive intermittently "500 internal server error".
I activate logging to debug level from apache, and also the PHP logging with E_ALL, but I can't find reference to Error 500 in any logs(I checked the right logs!).
I haven't got any .htaccess file in path script. The strange thing is that the error start at first php line in the script (the previous html displays correctly, but at the first php line the script send 500 error).
The cpu load is always good (max 0.15 0.08 0.01) and RAM is close to 95% but it arrived to swap just 2 times in a month with 2-5 MB.
Apache works with prefork with this values:
<IfModule prefork.c> StartServers 8 MinSpareServers 5 MaxSpareServers 20 ServerLimit 280 MaxClients 280 MaxRequestsPerChild 4000 </IfModule>
Everthing works correctly and I don't get any error in quiet times, but i start receive errors when traffic rises (6-9000 visits per hour).
Can i solve the problem increasing resources? (i can upgrade RAM up to 16 GB).
It can depend from reaching MaxClients (but apache must write it on log, right?)?
If I upgrade RAM to 6 or 8 GB i have to calculate MaxClients value with this?
MaxClients = Total RAM dedicated to the web server / Max child process size
Max child process size is around 20M.
How else can the problem be?
Thanks in advance
Here is the php.ini section about error logging
error_reporting = E_ALL | E_STRICT display_errors = Off display_startup_errors = Off log_errors = On log_errors_max_len = 1024 ignore_repeated_errors = Off ignore_repeated_source = Off report_memleaks = On track_errors = Off html_errors = Off error_log = /var/log/php_errors.log
Everything that is not mentioned is commented.