[Last Call] Learn how to a build a cloud-first strategyRegister Now


Error 500 with large image

Posted on 2009-02-12
Medium Priority
Last Modified: 2012-05-06
We have an application that runs OK on one server but is slow & sometimes does not end correctly.

We are trying to move it to another server, we get a 500 Server Error.

The application processes images, sometimes large images, depending upon the images the customer uploads.

My co-developer thinks it is because of php memory limit. I have put a php.ini into the server folder upping memory to 128MB. It still fails.

My co-developer did a simple script to test for failuse, it is in the code below.

You can try the test script at a server that fails (www.rkassoc.net/ybads/test.php. You will get a Server 500 error.

You can try it at a server where it works, www.rkassociates.com/ybads/test.php.

What is the problem?
$i_resized = imagecreatetruecolor(2825, 2620);

Open in new window

Question by:Richard Korts
  • 4
  • 2
LVL 34

Expert Comment

by:Beverley Portlock
ID: 23625791
I do not see anything on the server that succeeds, just a white background. It is possible that it also fails on the "working" server.

Do a phpinfo() on both machines and compare them see what is different. Look in the error log (probably /var/log/apache2/error.log) and see if there are any messages.

Load the image into a graphics package and see what it reports (if anything)

Author Comment

by:Richard Korts
ID: 23625943
To bportlock:

When you say "Load the image into a graphics package" do you mean like Paint Shop Pro or Photoshop?. If so, the images I have been testing with were created that way.

This is a commercial web server (1 & 1), I do not think I have access to the log files you mentioned. I'll look & see.
LVL 34

Accepted Solution

Beverley Portlock earned 2000 total points
ID: 23626258
"This is a commercial web server (1 & 1), I do not think I have access to the log files you mentioned. I'll look & see"

I think that they create a subfolder in your web space and put the errorlog in there, but that might be fasthosts rather than 1and1. I notice that the "faulty" server is the one at 1and1 and  they set a hard limit of 20M on PHP no matter what you set memory_limit to in php.ini.


Since this is a large graphic image it may be that the intermediate representation causes the server to run out of memory thus causing the internal error.
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 34

Expert Comment

by:Beverley Portlock
ID: 23626266
Hmm.. that link did not post correctly. I'll try it again


Author Comment

by:Richard Korts
ID: 23626669
To bportlock,

Do you know if Verio does that too?

We have another account with them. I tried the test & it failed. I loaded a php.ini with 128M memory limit & it still failed.
LVL 34

Expert Comment

by:Beverley Portlock
ID: 23627778
I'm sorry, I've never even heard of verio.

With GD functions, memory is usually the constraining factor but do check for other obvious problems. Make sure the file exists on both servers, make sure it is spelt the same way, make sure the path to the file is correct. These are all items that can cause the GD functions to crash.

You really need to see the error logs.

Featured Post


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses
Course of the Month17 days, 17 hours left to enroll

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question