PHP output buffer problem

Discussion in 'PHP' started by Jawn, Apr 13, 2009.

  1. #1
    Hello all

    Im trying to understand how ob_start and end works, currently its using a lot of disc performance due to 500 requests per second on my webserver which kinda halts the discs.

    So what im trying to do is to use ob_start because thats only using memory but im not sure how it works really and i would appreciate if someone could help me.

    
    	$data = 'iVBORw0KGgoAAAANSUhEUgAAABwAAAASCAMAAAB/2U7WAAAABl'
           . 'BMVEUAAAD///+l2Z/dAAAASUlEQVR4XqWQUQoAIAxC2/0vXZDr'
           . 'EX4IJTRkb7lobNUStXsB0jIXIAMSsQnWlsV+wULF4Avk9fLq2r'
           . '8a5HSE35Q3eO2XP1A1wQkZSgETvDtKdQAAAABJRU5ErkJggg==';
    
           
    	$data = base64_decode($data);
    
    
    	//ob_start();
    	
    	$im = imagecreatefromstring($data);
    	header('Content-Type: image/png');
    	imagepng($im);
    	
    	//ob_end_clean ( );
    
    PHP:

     
    Jawn, Apr 13, 2009 IP
  2. EricBruggema

    EricBruggema Well-Known Member

    Messages:
    1,740
    Likes Received:
    28
    Best Answers:
    13
    Trophy Points:
    175
    #2
    why not caching the results? disk is mostly faster then MySQL (except when mysql loads into memory). And most frequently used files are cached to into memory.. it's better to cache output and use the cache instead of creating the same page over and over again..
     
    EricBruggema, Apr 15, 2009 IP