"Internal Server Error" when trying to upload a 5mb file using PHP

I’m getting a Internal Server Error when trying to upload one 5mb file using PHP.

There’s not wrong with the script, it works fine on my localhost.

But online no luck. Does not work.

I already edited the php.ini file and increased the file limit to 640M and Time limit to 3600 seconds.

The error:

[code]Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, webmaster@sasapps.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.[/code]

Thank you.

as well as the file size limit, there is also a memory limit to consider

several variables need consideration…


You might want to read up on these

thanks for the reply dajuk.

I updated these. Let me show to you the values I used:

upload_max_filesize 640M
post_max_size 640M
memory_limit 640M
max_execution_time 3600
max_input_time 3600

My PHPinfo:

I emailed the support and got this answer:

[quote]Yes, you process is triggering our process monitor. Please understand
that this feature is in place to prevent users from monopolizing
resources on the shared server. I can suggest that you try optimizing
your code.[/quote]

It’s just one small php file with the upload code, standard one.

The file is small, 5mb, but I’m unable to upload at all. I don’t know if it’s because I used these big numbers on the limits/PHP.ini

you are uploading a file, but how long does it take? if your speed is too slow and it takes too long, DH will kill your process because it will appear to be hanging. I think 30 s is the maximum execution time.

I thinking it’s taking some time. Can’t I change this time?

Can I increase to 120 seconds? 60seconds?

you can if you have VPS. One thing that shared servers don’t offer is unlimited CPU time. Bandwith and disk space are unlimited, but CPU time is restricted to a reasonable level. if you are just doing this one time, then upload it via ftp and point your php file to the local file rather than uploading it via php.

Or get a faster internet connection so that uploading doesn’t take so long

Thanks for the reply bobocat. Do you know who many seconds is the default timeout here at Dreamhost?


i don’t, sorry. i know that DH’s webFTP interface gives you 30 seconds for an upload though. I would guess that it’s not just a function of time though. Write a long process and time it until it’s killed and let us know.

Any updates on how you were able to fix the problem?

i think it’s somehow timing out your actual connection, thus causing the upload to disconnect… either that or something dealing with permissions.

Do you have any static addresses in your script, that might also be a reason why it will upload locally, but not on your server. As far as the time out theory goes, you could try uploading smaller and smaller packages until you finally succeed or fail.