Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I just copied all my files from one Ubuntu server to another, and everything works fine, except that Apache returns a "ERROR 500 - Internal Server Error!" on image files that on the old server was uploaded by the user himself through a PHP script.

I log in to the server through the terminal with ssh as root.

Checking the file permissions using the "ls -l" command through terminal shows the following:

Example of a file that Apache does display correctly:

-rw-r--r-- 1 root root 41K Jan 6 03:27 layout1.png

Example of a file that returns the 500 error:

drwxrwxrwx 3 root root 4.0K Jan 6 03:41 516191110e5e1

I did try "chmod 644 -R *" on the files after a tip from stackoverflow, but then the apache error changes to "403 forbidden".

Any ideas what caused it, and how to solve the problem?

share|improve this question
How did you move the files between servers? Did you use FTP or some sort of media? Also is this website WordPress, some other CMS, or something else entirely? – ryanlee Jan 6 '14 at 3:33
They were moved using the Filezilla client logget in as root with SFTP. The "system" is just a PHP site I have written myself. – Publicus Jan 6 '14 at 3:35
Can you verify that you included the right entry for what's returning the 500 Error? 'Cause what you listed is a directory, not a file. Granted, it has 777 permissions, but code that's calling it as an image resource may not parse a folder very well. – douggro Jan 6 '14 at 4:28
Sorry, you are correct. The 500 error is returned by "-rw-r--r-- 1 root root 20360 Jan 6 03:28 520299b9a3e54.jpg". This is after trying some of the solutions posted by ryanlee, now the error returned is 403. – Publicus Jan 6 '14 at 4:32
@Publicus Okay, thanks for clearing that up. What method are you using to access the images? HTML link? Have you tried copying the the images to another, new folder in the directory and tried viewing them by directly entering the URL for them? – douggro Jan 6 '14 at 5:30

I've ran into similar problems when moving files between web servers and I offer up a few different things you can try.

First, make sure that when using Filezilla that under "Transfer" -> "Transfer Type" that "ASCII" is not checked, that can cause the very error you are having. (Also, make sure the names of the files haven't changed for some reason, I don't suspect this one but have seen it happen before in a move).

Second, try doing "chown root:root" on the files your uploaded, seriously, don't ask me why but this sometimes does the trick even when it appears the files have the right permissions.

Finally, download the files you uploaded to the server and check them on another computer to make sure that they weren't corrupted in the transfer. If they were, try uploading them again.

share|improve this answer
Thanks for the suggestions. All other images are displayed correctly - and when downloading the images with Filezilla and opening on my mac they display correctly. The transfer method is also checked and it's correct. I also tried the chown root:root with no change. This is quite weird.. – Publicus Jan 6 '14 at 3:59

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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