阿帕奇在30秒后投掷500

I'm running Apache2 and PHP5 on a dedicated VPS.

I have a script that should finish anywhere from 20-50 seconds. It works just fine, but if it takes over 30 seconds due to the rows it selected, it instantly kills the script and says:

"Service Unavailable - The service is temporarily unavailable. Please try again later."

I have max_execution_time=60, max_input_time=60 and memory_limit=256M in my php.ini.

In apache2.conf, I have Timeout=300.

In the script itself, I'm also using set_time_limit(0); ignore_user_abort(true); ini_set('max_execution_time', 0); ini_set('memory_limit', '512M');

No matter what I change the script dies anytime the loading takes over 30.00 seconds and nothing is appearing in any of my logs.

Any suggestions on what other settings to try?

This script is for internal use only and will eventually be running from command line, but I prefer to debug/test from the browser.

An internal server error. Check that all your directives are correct. If you have an .htaccess file, make sure you don't have any typos. Other than that, you can debug your script. You maybe changing a setting that triggers the error or conflicts with something else on the server.

Do you have Mod_Security or php-suhosin installed? Those might interfere with the default configurations.

The error you listed: "Service Unavailable - The service is temporarily unavailable. Please try again later." doesn't sound like a 500 response, it sounds like a 503. Are you sure you are getting back a 500? The causes for a 503 would be different.