11

I'm getting this error:

The connection to the server was reset while the page was loading.

This only occurs when I try to load an image using ImageMagick.

<?php 
header('Content-type: text/html');
$image = 'some_image.jpg';

/*** a new imagick object ***/
$im = new Imagick();

/*** ping the image ***/
$im->pingImage($image);

/*** read the image into the object ***/
$im->readImage( $image );

/**** convert to png ***/
$im->setImageFormat( "png" );

/*** write image to disk ***/
$im->writeImage( '/tmp/new.png' );

echo 'Image Converted';  
?>



vertrigo serv
php 5.3.8
php_imagick_ts.dll

Apparently same problem here: http://valokuva.org/?page_id=50

I can get it loaded, phpinfo displays imagick information, but when trying to read an image Apache crashes.

Any idea about this problem?

Gras Double
  • 15,901
  • 8
  • 56
  • 54
Daniel
  • 578
  • 1
  • 8
  • 22
  • Do your logs happen to give any clues? – jprofitt Dec 22 '11 at 18:54
  • 2
    Imagick is a pain to get working on 32/64 Windows. 5.3+ is practically impossible to work. Imagick was exactly the reason why I switched from Windows for development. That and a ridiculous DateTime bug that only happened in Windows. – Layke Dec 22 '11 at 19:03
  • Where did you get the *php_imagick_ts.dll* file? Does it come with VertrigoServ? – Álvaro González Dec 22 '11 at 19:08
  • no. download from http://valokuva.org/builds/ and copy to ext folder. @Layke, i think you need something like `date_default_timezone_set('Europe/Lisbon'); $tz = date_default_timezone_get();` – Daniel Dec 22 '11 at 19:13
  • Those are VC9 builds. You'd need to verify that your PHP binaries are VC9 as well. Good old [phpinfo()](http://php.net/phpinfo) will suffice. – Álvaro González Dec 22 '11 at 19:19
  • PHP binaries are VC9 too. God, imagick is the devil. – Daniel Dec 22 '11 at 19:28
  • Which compiler has been used to compile your webserver? The other suggestion is to use `realpath` on filenames first. – hakre Dec 24 '11 at 00:08
  • I "heard" doing some search that this could be possibly a real BUG without workout. Everyone having the same problem switched to Linux to have this solved. – Pabluez Dec 25 '11 at 13:11
  • I have detailed the correct installation procedure for an other question, see [this answer](http://stackoverflow.com/questions/3036847/how-to-install-imagemagick-on-windows-7#22210399). – Gras Double Dec 05 '15 at 05:18

3 Answers3

3

There is similar problem: Imagick constructor crashes PHP/CGI

I've had the same issue today. You have to install version of Image Magick no higher than 6.6.4.0 - next builds are made using VC10 which seems to be incompatible with Apache VC9 + PHP5.3.x VC9.

Some comments on this: http://valokuva.org/?p=161#comment-20707

You can get older releases of Image Magick here: http://image_magick.veidrodis.com/image_magick/binaries/

And remember to reboot windows after installing Image Magick

Community
  • 1
  • 1
BartekR
  • 3,827
  • 3
  • 24
  • 33
  • +1 this worked for me on Windows 7 with xampp: http://image_magick.veidrodis.com/image_magick/binaries/ImageMagick-6.6.4-0-Q16-windows-dll.exe and http://valokuva.org/builds/ext/vc9/ts/imagick/2011-04-25_1849/php_imagick_ts.dll (renamed it to php_imagick.dll and added it to /xampp/php/ext) – AlienWebguy May 31 '12 at 06:20
  • The provided link to older releases no longer exists. someone help? i don't know where to find – Loonb Jan 25 '14 at 14:56
  • Found something there: ftp://mirror.imagemagick.org/pub/ImageMagick/legacy/ Give it a try and tell us if it worked – BartekR Jan 26 '14 at 21:45
  • If you are looking for a mirror for older releases, here you have one: ftp://ftp.sunet.se/pub/multimedia/graphics/ImageMagick/binaries/ – Ryan Casas Oct 22 '15 at 16:09
1

I just got the same error in my new server, if using PHP "new Imagick("$imagebath")"

the fix is:

set "php.ini" "memory_limit = 256M" (or more, it was 128, it's not enough), error log: "Out of memory in UB xxx: OOM killed process x (httpd)..." So the request was reset to browser.

Nic
  • 12,220
  • 20
  • 77
  • 105
Tom
  • 117
  • 11
0

In PHP 5 the file has to be php5.ini
Add these lines in php5.ini

post_max_size = 48M
file_uploads = On
upload_max_filesize = 192M

You can set the sizes to whatever you want.

markusschmitz
  • 676
  • 5
  • 18
Johnny Wind
  • 151
  • 8