Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: VERY long php-script crashes
02-09-2013, 01:26 PM #1
- Join Date
- Jul 2009
- Odense, Denmark
- Thanked 0 Times in 0 Posts
VERY long php-script crashes
I've found some forum posts regarding this subject around the web, but nothing really seems to hit the spot. I thought I'd ask the pros.
I have a php-script. A very, VERY long php-script. It basically retrieves a bunch of info from my MySQL-db, creates a pdf (using fpdf) with the info and then outputs the pdf as a file to my server... the script does this about a 1000 times (and this number will only increase in the future).
The problem is that after about 400 rounds the browser (I'm using Chrome as a rule but the problem persist with all major browsers) returns the "No data recieved"-error and stops the script.
My logic tell me that this is either the server taking too long or the browser panicking about not getting anything back from the server.
I've tried to solve the first of my thought by adding
Of relevant information I might add that my site is hosted with a third-party hosting company. Also they run PHP4 (don't worry, I'm already trying to change my host to one that runs PHP5.
What do I do about my script to make is stop crash?
Best regards and thanks in advance,
02-09-2013, 02:20 PM #2
- Join Date
- Sep 2002
- Saskatoon, Saskatchewan
- Thanked 2,662 Times in 2,631 Posts
Two more options is that the script has received an abort from the client (browser issue), and you have run out of available memory to work with.
To trouble shoot this, I'd take it down to a local machine which has PHP available, and run it from the command line. If it works, than it's likely a browser issue. If it doesn't work, then it should give you an error which if I had to guess would be memory.
This may also be an issue with simply the PHP4 version.
Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)PHP Code:
header('HTTP/1.1 420 Enhance Your Calm');