|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57835 Imagick extension causes Apache to reset connection
Submitted: 2007-09-12 13:31 UTC Modified: 2007-09-14 09:23 UTC
From: neil at scare dot me dot uk Assigned:
Status: Not a bug Package: imagick (PECL)
PHP Version: 5.2.1 OS: Debian testing x86
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
45 - 27 = ?
Subscribe to this entry?

 [2007-09-12 13:31 UTC] neil at scare dot me dot uk
Sometimes Apache resets the connection with the browser when a PDF document is loaded into Imagick. I haven't found a way to reproduce it every time, but reloading the script below a few times usually triggers it. This seems to occur with any PDF, but not with other filetypes.

Versions 2.0.0RC2 and CVS exhibit the problem.

Apache 2.2.4 with PHP 5.2.3

Reproduce code:
header('Content-type: image/jpeg');
$img = new Imagick;
$img->setResolution(288, 288);
$img->resampleImage(144, 144, imagick::FILTER_LANCZOS, 1);
print $img;

Expected result:
map.pdf should be loaded and the first page output as a JPEG after being resized.

Actual result:
Apache resets the connection with the browser but the process doesn't die. gs continues to process the PDF document and the script performs the conversion to JPEG, but obviously nothing can be sent to the browser. Nothing is recorded in any error logs.

Any further attempts to load a PDF with Imagick immediately trigger the bug. Restarting Apache fixes it temporarily.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-09-12 13:41 UTC]
Sorry, but your problem does not imply a bug in PECL itself.  For a
list of more appropriate places to ask for help using PECL, please
visit as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PECL.

I am not sure if this an Imagick bug. Converting PDF to JPEG can be pretty resource intensive and that might be the reason why Apache resets the connection.

You can use $img->readImage('map.pdf[0]'); to read just the first page.
 [2007-09-14 09:23 UTC] neil at scare dot me dot uk
I did some further testing and it seems to have been a bug in Apache 2.2.4 from Debian testing. I haven't been able to reproduce it on Apache 2.2.6.
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sat Oct 24 04:01:23 2020 UTC