Gossamer Forum
Home : Products : Others : Fileman :

500 Server Error, Permissions, Field Width

Quote Reply
500 Server Error, Permissions, Field Width
I've been using filemanager for a while.
New to cgi/perl, no unix shell access.
About the time I started using filemanager,
my guestbook and exec cgi's stopped working.
I get a 500 Server error. I've set up a test for SSI and CGI. The SSI works fine. CGI does not. See below:

http://thunder.prohosting.com/~greenman/test.shtml
Text for same:
http://thunder.prohosting.com/~greenman/test-shtml.txt
Text for cgi
http://thunder.prohosting.com/~greenman/cgi-bin/test.txt

All permissions are set properly.

Is it possible that I'm getting this error because of a misconfiguration in Filemanager?

Number 2:
Currently I think all items default to 664 upon creation or download.
What line items in fileman.cgi do I need to change to:
a. Set folder permissions automatically to 755 upon creation.
b. Set file permissions automatically to 644 upon creation.
c. Set the edit field width to a wider and shorter setting in the file edit window.
Quote Reply
Re: 500 Server Error, Permissions, Field Width In reply to
Hi Chris:

I am not too sure what you mean when you say your exec cgi is not working. Could you give me an example of what you mean when you say it is not working? That would really help.

I think the folder permissions are set to 755 upon creation.

To set the file permissions to 644 automatically upon creation you have to do the following:

use the change_perm subroutine appropriately in the upload subroutine

for changing the edit field's size check out the textarea tags in the subroutine edit

Hope that helps
Sun
Quote Reply
Re: 500 Server Error, Permissions, Field Width In reply to
Yes, thank you! Your two suggestions have been helpful.

With regards to CGI's:
I am using a mac. When I edit any
perl or cgi's in Filemanager, it saves the
document with hard carriage returns.
I've not tried editing cgi's in Filemanager
from a PC, so I don't know if the same
happens or if it is intentional.

While it's less of a problem for
html, I'd like to be able to edit my scripts
without adding hard carriage returns.

What are the options for fixing this?

Regards,

Chris
Quote Reply
Re: 500 Server Error, Permissions, Field Width In reply to
Hi Chris:

Are you editing the CGI files on Mac and then uploading the CGI files to a Unix server. If that is indeed what you are doing then you have to upload the CGI file from Mac to Unix in text mode. In that case, you do not need to worry about having added the hard carriage return.

If this is not your question, then I apologize in advance and I would like you to correct my understanding of your question.

Hope that helps
Sun



------------------
-------------------- Gossamer Threads Inc. ----------------------
Sun Djaja Email: sun@gossamer-threads.com
Internet Consultant
http://www.gossamer-threads.com

Quote Reply
Re: 500 Server Error, Permissions, Field Width In reply to
Sun,

Yes, the server is Unix. I'm using it on the Web from a protected folder. I edited the config portion of FileMan using BBEdit and uploaded it using Fetch. This method works well. Fetch is set to automatically send in the ascii or raw depending on the appropriate file type. (FileMan would not work at all, if I had uploaded as raw data.) In FileMan, I can view any folder, add, delete, edit files, etc., anywhere on the web from any browser. However, any file edited by FileMan replaces soft returns with hard returns when edited on a Mac. (It may be the same on a PC, I'm not sure.) These hard returns are, of course, death to CGI scripts. It results in a 500 server error on any script or cgi config file I edit with FileMan. I'd like to be able to edit cgi files from home or work without fear of introducing 500 server errors.

How can I fix FileMan so I can upload CGI's and all other files without putting in un-asked-for hard carriage returns? I don't see a setting for it anywhere, so it may not have been considered when the script was written.
I honestly don't know enough perl to write a subscript for this, so I need to know if this is something I can fix, or if it is something GTI would be willing to include in an upcoming version.

Regards,

Chris

[This message has been edited by Chris Green (edited November 17, 1999).]
Quote Reply
Re: 500 Server Error, Permissions, Field Width In reply to
disregard this post. c.

[This message has been edited by Chris Green (edited November 17, 1999).]
Quote Reply
Re: 500 Server Error, Permissions, Field Width In reply to
Hi Chris:

Ok, I think I can help you if you would tell me how this hard carriage returns look like. Are they like this: "\r\n" or "\n" or something else? Pardon me for my ignorance. I have only used Mac as a workstation to check email and I do not know much about Mac at all. If you tell me what it looks like I might be able to provide you with some program statements that would enable you to realize what you want.

Eagerly waiting for your reply
Sun
Quote Reply
Re: 500 Server Error, Permissions, Field Width In reply to
Mac uses the hard return at the end of every paragraph as defined by the inputter, such as at the end of this sentence.

These are the respective ascii symbols involved:
Dec Hx Oct Char
---------------
10 A 012 LF
(NL line feed, new line, /n )

13 D 015 CR
(carriage return, /r [or /r/n ?] )


I don't know if the problem _is_ due to the difference between uses of these two characters in Mac and Windows, but I think that's the case. I hope this helps.

Regards,

Chris

[This message has been edited by Chris Green (edited November 22, 1999).]
Quote Reply
Re: 500 Server Error, Permissions, Field Width In reply to
Hi Chris:

In subroutine write:

open(FILE,">$fullfile") or &cgierr ("Can't open: '$fullfile'.\nReason: $!");
print FILE $data;
close(FILE);

locate the above.

before: print FILE $data;
insert this line:
$data =~ s/\r\n/\n/;

I think that should help
Cheers
Sun
Quote Reply
Re: 500 Server Error, Permissions, Field Width In reply to
Sun,

I can't believe that little line is all it needed. Seemed more complicated. Thanks for helping. I've not tried it yet, but will upload this tonight and try a new cgi test.
Thank you!

Along the same lines. I've been loath to make this change for the automatic settings on the permissions (from earlier part in thread). Starting near the end of sub upload, is this the way it should look?

close OUTFILE;
#automatically change permission here.
change_perm ($fullfile, 644)
&exists($fullfile) ?
return (int($file_size / 1000), "Upload: '$filename' uploaded.") :
return (int($file_size / 1000), "Upload: Cannot upload '$filename'. Check permissions.");
Quote Reply
Re: 500 Server Error, Permissions, Field Width In reply to
Hi Chris:

I think you will have to do something like this instead: (you are pretty close)

&exists($fullfile) and (change_perm ($fullfile, 644));
&exists($fullfile) ?
return (int($file_size / 1000), "Upload: '$filename' uploaded.") :
return (int($file_size / 1000), "Upload: Cannot upload '$filename'. Check permissions.");

That should be it.

Cheers
Sun