Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-09-2013, 01:26 PM   PM User | #1
deafdigit
New Coder

 
Join Date: Jul 2009
Location: Odense, Denmark
Posts: 70
Thanks: 4
Thanked 0 Times in 0 Posts
deafdigit is an unknown quantity at this point
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.
__________________
HornskovVindberg inkasso
deafdigit is offline   Reply With Quote
Old 02-09-2013, 02:20 PM   PM User | #2
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,653
Thanks: 4
Thanked 2,451 Times in 2,420 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
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.
__________________
As of PHP 5.5, the MySQL library has been officially deprecated. It is recommended to move to either MySQLi or PDO libraries for your mysql connectivity. See here for help choosing which interface you prefer: http://php.net/manual/en/mysqlinfo.api.choosing.php
Fou-Lu is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:21 AM.


Advertisement
Log in to turn off these ads.