Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

That's really strange :So after i upload a folder with php files on another service,and try to execute them from a browser,i get 500 error.If i open a file in a text editor,save it with different name like file1.php,then erase the original,and rename the file1.php to the previous name,it works.

share|improve this question
    
What Webserver do you use? Apache/IIS? Is there anything in the error logs? –  fab Mar 19 '11 at 20:33
    
That sounds like a cache issue. I would see if clearing the browser cache fixes it. –  JOTN Mar 19 '11 at 20:37
    
@fab I use Apache and I found nothing in the error logs about those 500 errors. –  a44 Mar 19 '11 at 20:43
    
@JOTN clearing cache doesn't help and I don't see how that can be related,because the browser gets 500 responce from the server every time. –  a44 Mar 19 '11 at 20:44

2 Answers 2

up vote 5 down vote accepted

This sounds a lot like a permissions issue. When you save the "second" file, you're saving it with permissions 0644 by default, with your user/group, at least on *nix. If you want, post the the output of ls -l file1 file2 before you do the rename, and I can give you a better answer.

As for permissions, try changing the permissions on the original file by using chmod:

chmod 0644 <file>
share|improve this answer
    
You are ...just prefectly right.Thanks ,and why the scripts didn't work with chmod 0664 –  a44 Mar 19 '11 at 20:55
    
I'm glad it fixed it! I'm not actually sure why, but it sounds like a possible security feature. I.e., don't let Apache execute arbitrary scripts that are executable on the system (I.e., /bin/cat). But that's just a wild guess... :) –  Andrew M. Mar 20 '11 at 3:08

The sequence "upload, fail, edit, save, rename, succeed" tells me that it's likely a line-ending issue. Try running:

dos2unix original-uploaded-file

to see if that fixes the problem.

share|improve this answer
    
i thought that it MUST be something like that,but in the first place my developer environment is *nix and the hosting server is *nix and Redmumba was right-it has been a matter of permissions –  a44 Mar 19 '11 at 20:58
    
But this is definitely one of the steps to take to debug future issues, of course! :) –  Andrew M. Mar 20 '11 at 3:10

Your Answer

 
discard

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.