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.
Asked
Active
Viewed 97 times
1
-
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
5
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>

Andrew M.
- 11,182
- 2
- 35
- 29
-
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 03:08
2
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.

Dennis Williamson
- 62,149
- 16
- 116
- 151
-
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 03:10