Ubuntu – Long running PHP script gets terminated

PHPUbuntuvps

I have a lot of scripts running cron scheduled on VPS running Ubuntu 10.04. Every once in a while when server load gets heavy (I run munin as monitoring tool), I notice from my logs that many of running scripts gets killed and only thing I see is "Terminated" in the end of the log file. It's not PHP's max execution time because that's set long enough.

Is this something that my VPS provider does in order to fight against the load or is this something Ubuntu does in order to keep system responsive? According munin, my VPS is pretty weirdly configured. I see I have over 30 gigs of memory even I pay only for 512MB. Also I have noticed that I'm constantly over 512MB, especially during heavy loads. That's why I'm wondering if this is something my VPS provider does. Actually if they just came straight out and told me I'm running way too high, I would happily upgrade to 1GB package but terminating scripts without any notification isn't very good practice in my opinion.

Best Answer

The default script timeout for PHP is 30 seconds. It can be altered in the php.ini file or via the set_time_limit() function.

http://php.net/manual/en/function.set-time-limit.php