CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   PHP (http://www.codingforums.com/forumdisplay.php?f=6)
-   -   VERY long php-script crashes (http://www.codingforums.com/showthread.php?t=287365)

deafdigit 02-09-2013 01:26 PM

VERY long php-script crashes
 
Hi all,

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

PHP Code:

set_time_limit(0

to the top of my script. This does not solve the problem. This leads me to believe that the problem has to do with the browser but I've absolutely no idea how to solve that.

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,
deafdigit.

Fou-Lu 02-09-2013 02:20 PM

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.


All times are GMT +1. The time now is 04:35 AM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.