1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Issue with displaying PHP pages having large size

Discussion in 'PHP' started by PHP dev, Jul 17, 2008.

  1. #1
    When I am trying to display a web page which is more than 12MB, it takes too much time to load and error will pop up with the following message:

    Warning : Unresponsive script , stop the script and continue.
    is there any better solution to display pages having large size (like as chunks)?

    Thanks
     
    PHP dev, Jul 17, 2008 IP
  2. revvi

    revvi Peon

    Messages:
    58
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    is the code size really 12 MB? or it includes images/flash/or any which becomes 12 MB?
     
    revvi, Jul 17, 2008 IP
  3. PHP dev

    PHP dev Peon

    Messages:
    16
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks for your reply

    The page contains only text contents no images or other scripts. It is a text file which is stored in mysql as compressed format and I am taking it from db, decompressing and trying to display. But at the point of decompression it ok and then it fails.
     
    PHP dev, Jul 18, 2008 IP
  4. revvi

    revvi Peon

    Messages:
    58
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    It is advised to split the data into chunks. Is it for download purpose? Or just displaying your very long text file?

    Another thing, try to increase the execution limit on php. Usually it's around 30 seconds. But now try to use 0, it means unlimited.

    
    set_time_limit(0);
    PHP:
    At the end, I still don't know why you need 12 MB static text files. :)
     
    revvi, Jul 20, 2008 IP
  5. PHP dev

    PHP dev Peon

    Messages:
    16
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    It is not for download propose, just displaying the large content.
    usually for small documents it is working fine and for large ones this problem occurs

    Could you specify how to display in chunks?

    and here is the answer of your last quest: It is some data mining process, fetch raw file, process, store in db and display :)
     
    PHP dev, Jul 21, 2008 IP
  6. revvi

    revvi Peon

    Messages:
    58
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Hi,

    If you were storing that big data into 1 BLOB mysql field, then it's no luck to use splitting. It is still possible, but still you will find your php script takes longer process time to retrieve all 12 MB data and then display it.

    You must redesign the database on how you store the data. If you can provide more details on your database structure, perhaps I can suggest to use pagination. You can also find pagination technique in this forum. (I forgot where it is). :)
     
    revvi, Jul 21, 2008 IP
  7. Cri2T

    Cri2T Peon

    Messages:
    104
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #7
    I would suggest he uses PHP to generate HTML files rather than store it in the database... that's a ridiculous amount of data. Since PHP parses the request to the database, and pulls the info from the database and displays it every time someone loads the page, you will see a significant performance hit on your server if you get more than say, 5 people loading the page at a time (this is a bit of an exaggeration, though if you're on a shared host and serving those sized files to 50+ users, your bandwidth will go down the tube fast; and I'd say about 50 (+/- 25) users on the site before it fills the servers ram completely).

    I also wouldn't put it all in one html file either, but split it up as pages. This way the HTML file doesn't make the PHP engine start up when the page is opened, which takes alot of pressure off of your server.

    If you don't, I truly hope you have Zend Optimizer installed on your server so the PHP is at least caching the binary data.
     
    Cri2T, Jul 21, 2008 IP
  8. PHP dev

    PHP dev Peon

    Messages:
    16
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Thank you for your responses!

    I am using the MySQL blob field to store this data and compressing it before saving in the database (this 12MB takes only 500KB space in db). The other thing is, it is saving as a php object, so there no transformation for each request just fetch the data as display as itself. There are millions of records in the database and it is tuned to handle the requests from multiple users. There are a few documents having this issue (<150).

    The thing I want to know is, whether I can able to display this large text in chunks with in a single page. I mean display one block first, after completing send the request and take the next block and so on and this is in a single page. I don't want to paginate the same file into multiple pages

    The error message I am getting is
    Warning : Unresponsive script
    A script on this page may be busy, or it may have stopped responding. You can stop the script now, or you can continue to see if the script will complete.
     
    PHP dev, Jul 22, 2008 IP