Jump to content

Getting an OK 200 Error?


jebego

Recommended Posts

So, every time I run my code, I get this error:

OK

The server encountered an internal error or misconfiguration and was unable to complete your request.

 

Please contact the server administrator, support@supportwebsite.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

 

More information about this error may be available in the server error log.

 

Apache/1.3.33 Server at xxxxxxxxx.com Port 80

... and here's the last 4 errors from the error log:

173.48.xxx.xxx - - [05/Jun/2010:21:48:01 -0700] "GET xxxxxxxxx.com/mosaic/image_merge.php HTTP/1.1" 1 573 "-" "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 GTB7.0 ( .NET CLR 3.5.30729)"

173.48.xxx.xxx - - [05/Jun/2010:21:52:17 -0700] "GET xxxxxxxxx.com/mosaic/image_merge.php HTTP/1.1" 200 21540355 "-" "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 GTB7.0 ( .NET CLR 3.5.30729)"

173.48.xxx.xxx - - [05/Jun/2010:21:52:35 -0700] "GET xxxxxxxxx.com/mosaic/image_merge.php HTTP/1.1" 200 257478 "-" "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 GTB7.0 ( .NET CLR 3.5.30729)"

173.48.xxx.xxx - - [05/Jun/2010:22:02:52 -0700] "GET xxxxxxxxx.com/mosaic/image_merge.php HTTP/1.1" 1 573 "-" "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 GTB7.0 ( .NET CLR 3.5.30729)"

Because of the length of my code, I won't post it all, but here's the chunk where the error has appeared, then stopped the script:

$image_number = 0;
for($row = 0; $row < $rows; $row ++){	

loader(60 + 30*($row / $rows));

for($col = 0; $col < $columns; $col ++){		
	$copy_image = imagecreatefromjpeg($url_array[$image_number]);
	if(!$copy_image){
		$copy_image = imagecreatefromjpeg($url_array[$image_number - 1]);
	}
	$copy_image_width = imagesx($copy_image);
	$copy_image_height = imagesy($copy_image);
	if($copy_image_width > $copy_image_height){
		$copy_image_width = $copy_image_height;
	}else{
		$copy_image_height = $copy_image_width;
	}
	imagecopyresized($final_image, $copy_image, $size * $col, $size * $row, 0, 0, $size, $size, $copy_image_width, $copy_image_height);
	$image_number ++;
}
}

Basically what this does is go through an array ($url_array) filled with URLs to images on another site, then scales, crops, and places them on my previously made $final_image into a kind of mosaic using imagecopyresized().

 

The final image is 66 by 66 images, so that's ~4000 images.  The overall process should take around 12 or so minutes, but it keeps getting stopped by this error somewhere around the 9 minute mark. I've also deduced that the error comes between the 45th and 55th row changing every time I run the script.

 

From these observations, I don't think it's a problem with any individual image I'm getting, but some kind of limit set. Because of this, I went over my php.ini file, that I had modified earlier to accommodate a high-resource script like this, here's my php.ini:

max_execution_time = 1000

max_input_time = 1000

default_socket_timeout = 1000

memory_limit = 400M

post_max_size = 100M

file_uploads = On

upload_max_filesize = 100M

output_buffering = 4000

 

I'm using PHP Version 5.2.8 and using shared linux hosting on Godaddy.

 

Sorry about the large amount of info and such, but I think that most if not all of it's applicable. Tell me if any more information is needed :)

 

So, any idea what's going on? Thanks!

Link to comment
Share on other sites

Update: I created another array of URL's that pointed to different images than the previous one. This one also had only 44 rows. This one ended up working!

 

So, it seems that my theory was correct, there's some kind of limitation set in place, but I still can't figure out what it is =/

Link to comment
Share on other sites

keep in mind your cutting it close with your limits:

 

max_execution_time = 1000

max_input_time = 1000

default_socket_timeout = 1000

memory_limit = 400M

post_max_size = 100M

file_uploads = On

upload_max_filesize = 100M

output_buffering = 4000

 

1000 seconds is approx 16 minutes.  Now, you did say your script takes about 12 minutes or so, but how sure are you?  For output_buffering, you have it set to 4000 bytes.  Perhaps you should set to standard 'on' which allows for an unlimited buffer, just to ensure that is also not the issue.  Consider cranking up your limits in your php.ini to see if you are maxing out somewhere.

Link to comment
Share on other sites

Ok, here are my new php.ini settings:

max_execution_time = 10000

max_input_time = 10000

default_socket_timeout = 10000

memory_limit = 40000M

post_max_size = 10000M

file_uploads = On

upload_max_filesize = 10000M

output_buffering = 4000

 

And I just tested it again, got an error at the same time as always. Seems like it's some other kind of limit =/

Link to comment
Share on other sites

you can also try changing your output_buffering value to on instead of a numeric value like so:

 

output_buffering = On

 

This sets the output buffer to an unlimited state whereas a numeric value caps it.  Just another thing to eliminate.

 

And, is this an internal call?  Or, are you using an API of some sort/making any external calls?

Link to comment
Share on other sites

For some reason, setting output_buffering to On prevents anything from displaying on my screen, then after a minute, I get a:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

 

Please contact the server administrator, support@supportwebsite.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

 

More information about this error may be available in the server error log.

 

Apache/1.3.33 Server at xxxxxxxxx.com Port 80

 

I had this problem before, and figured out (at least I think I figured out) that there was some kind of timeout imposed where if the page didn't receive some kind of data for 1 minute, then I would get a 500 error, so I modified my output_buffering to a 4000 cap, and modified my loader() code to add the $buffer variable, which fills up this cap. My script then runs up to the point that I can't get it past now. Could this be related to the problem?

 

Here's my loader code:

function loader($percentage){
$buffer = str_repeat(".", 4096);
   ?>
   
   	<script language="javascript">
	loading.style.width = '<?php echo $percentage; ?>%';
	loading_text.innerHTML = 'Loading <?php echo $percentage . " " . $buffer; ?>%';
</script>
    
   <?php
    ob_flush();
flush();
if($percentage == 100){
	?>

	<script language="javascript">
		loading_text.innerHTML = 'Loaded!';
	</script>
        
	<?php
}
}

 

And, what do you mean by an internal/external call? Do you mean, is my code accessing external resources? It's getting the images from another site.

 

Sorry, I haven't been using PHP for that long :)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.