I have setup default Ubuntu Server 12.04 on Amazon EC2 micro instance. I've setup the usual, PHP, Apache, MySQL, etc. Everything runs ok, until I try to upload some file via PHP. The file size does not matter. It happens even with 5kb jpeg file. What I get is:

[Thu Nov 08 18:52:11 2012] [notice] child pid 1199 exit signal Segmentation fault (11)

When I execute the same code, but without ataching the image, it works (but I need the image, of course)

I have to note that exactly the same code is working great on an OpenSUSE 11.1 machine, I'm just moving it on Amazon instance for further testing. I've setup dozens of servers and never encountered this error. I really am stuck, as I could not find anything related.

uname -a gives

Linux server 3.2.0-31-virtual #50-Ubuntu SMP Fri Sep 7 16:36:36 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

Apache/2.2.22 (Ubuntu), PHP 5.3.10-1ubuntu3.4

php variables:

post_max_size   150M
memory_limit    256M
upload_max_filesize 150M

Note: I also added swap file 2Gb, and also tested the same on a bigger EC2 instance with 1.7Gb of RAM, just in case, and the result was exactly the same, so it's not insufficient memory.

  • Does dropping the post_max_size and upload_max_filesize help? – David Schwartz Nov 8 '12 at 22:08
  • No, it was initially very low and it was the same. – kkazakov Nov 9 '12 at 3:48

I have finally resolved it. Turns out, there's a bug in imagefillborder() method. I was able to trace it to these rows, both failing:

I have to note that this code WORKS on PHP 5.2.x, so this means it's a new introduced bug in 5.3.x.

My image size is 296 px x 296 px. I'm creating rounded corners and filling all four corners with a color. These that fail are the top right and bottom right corners ( notice the second value matches the image size ). When I decrement with 1px, it works as supposed.

Really weird bug.

This one segfaults:

imagefilltoborder(Resource id #95, 296, 0, 1924607, 1924607);
imagefilltoborder(Resource id #95, 296, 296, 1924607, 1924607);

This one works:

imagefilltoborder(Resource id #96, 296-1, 0, 11333839, 11333839);
imagefilltoborder(Resource id #96, 296-1, 296-1, 11333839, 11333839);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.