Error 500 with large image

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 ( You will get a Server 500 error.

You can try it at a server where it works,

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

Open in new window

Richard KortsAsked:
Who is Participating?
Beverley PortlockConnect With a Mentor Commented:
"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.
Beverley PortlockCommented:
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)
Richard KortsAuthor Commented:
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.
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Beverley PortlockCommented:
Hmm.. that link did not post correctly. I'll try it again
Richard KortsAuthor Commented:
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.
Beverley PortlockCommented:
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.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.