Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jul 2009
    Location
    Odense, Denmark
    Posts
    72
    Thanks
    4
    Thanked 0 Times in 0 Posts

    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.

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    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.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •