Okay so I wrote a script that loops through a small bit of code until a certain condition is met. I also keep track of the amount of loops with an integer variable and then display the amount of loops once the condition is met. The main condition I am trying to meet most likely will take between 300,000 and 1,000,000 loops before it hits. Anytime it hits in the 100,000 range, everything works fine and it happens pretty quickly...probably five or six seconds. Anything else though I get the 500 internal server error. I assume this is directly related to the super cheap shared hosting I am testing this on? To be able to handle that many calcs do I need to be on a dedicated server? I guess I just need to know what needs to happen whether it be on my side or the server side to be able to handle this kind of loop. Thanks!
You may find useful information on your error logs. This is just my curiosity .. What is a super cheap shared hosting
You're probably running out of time because of the server's max_execution_time setting. That will automatically stop any script that continues beyond that value. Check your server's error log to find out for sure what the issue is. If it's an execution time problem you may be able to set some of the PHP settings in your .htaccess (depending on your host's settings). You can try this in your .htaccess file: php_value max_execution_time 30
Okay excellent...I thought it was something like that and I will check into it right away. nabil: I was just testing this on one of my other sites that just uses $6.99 a month godaddy hosting. I thought maybe there was some type of restrictive setting, but thanks to the replies now I know where to start looking. EDIT: Actually here is the error log: [Mon Apr 5 21:01:19 2010] [error] [client] Premature end of script headers: /var/chroot/home/content/a/b/s/mydirectory/html/pagename.php
To be honest, 300.000 loops is not something you want to happen unless you are doing some sort of benchmarking. I'd say that this has something to do with PHP memory limits
it could be suEXEC problem check out http://encodable.com/suexec_problems which might solve it. note : article uses perl.. but you can neglect that.. just read the part where it talks about apache.