Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help With CHMod

Status
Not open for further replies.

raevans

Programmer
Dec 3, 2002
28
US
Perhaps someone can help me with this dilemma. I am pretty much a adolescent newbie... but here it tis. I am incorporating an email script at our school for a contest. we have soaris platform, and I am trying now to test it out. when I call the submit.cgi script... i get the following error:
Method Not Allowed
The requested method POST is not allowed for the URL /public_html/cgi-bin/Submit.cgi.

We are running Apache 1.3.26

I tried telnetting into the main server and typing chmod +x Submit.cgi and the message I get is cant access Submit.cgi. I try changing dirctories with the cd command and get no such file exists... Any ideas???
TIA




 
CD to the directory where the cgi script resides.

Then type the following:

chmod 755 *.cgi

This will set the permissions for all .cgi files in the directory, but any scripts added later will have to be chmoded again. Of course, I am assuming you actually have rights on the machine to access that directory, and to change file permissions in it. If you don't, speak to the admin.

You can check the permissions of the files in a directory by typing ls -l (while your in the directory).

I'm learning too. If you find any excellent resources on the Web, let me know. I haven't found too many really good ones. My e-mail address appears below. Feel free to use it.

Greg@GregNorris.net _______________________________________
Constructed from 100% recycled electrons
 
Greg Thanks for the advice. I have found only this forum and also amdforum.com for any hardware related inquiries. As for getting the chmod command to work... I had trouble using the cd command to actually change the directories. I dunno y. Anyway, thanks for the input.
 
The combination of Perl / Apache / Solaris is very common. I don't think you'll see any 'OS' specific quirks with that environment. If this is a contuation of another thread about getting this working on a Win OS, there are a few things to pay attention to when moving a piece of code from a win box to a *nix box.

1 - line endings => *nix machines expect their text files to have line endings as just a 'new line'. Win machines use a 'new line' and a 'carriage return'. So, perl code written on one flavor OS must be converted to run on the other. To convert a Win flavored text file to *nix flavor, try using the 'dos2unix' command. For details, do 'man dos2unix' on the Solaris machine.

2 - The top line of your code, '#!/path/to/perl' may need to be changed. Make sure it points to the perl interpreter on the Solaris box. You can find that interpreter with the 'which' command, like "which perl -enter-".


3 - make sure the execute bit is set like "chmod +x your_code.cgi -enter-". It sounds like you've already taken care of this one.


If you have done those and are still having problems, try checking your syntax from the command line with
prompt# perl -c your_code.cgi -enter-

Fix any syntax problems reported. The '-c' switch causes the interpreter to check your syntax and then stop without actually running the code.

Then make sure that all file dependencies are OK. If the code is going to try to read or write a file, make sure the code has sufficient permissions to do so. Or, if the code is using 'sendmail' or any other system command, make sure the path to that command in your code is correct. Again, the 'which' command will work to find sendmail (which sendmail). Remember, when you hit a piece of CGI via a browser, the code does not run under your user setup, it runs as the http daemon. System admins usually setup the http daemon with very limited permissions for security reasons. The code may run fine from a command line where YOU have sufficient permissions and may lack some permissions when run by the http daemon in response to a browser request.

'hope this helps

If you are new to Tek-Tips, please use descriptive titles, check the FAQs, and beware the evil typo.
 
About the CD command. Unless you are simply drilling down one directory exactly, you must tell the system the full path. As follows:

CD ../images/

This says "Go up one level, then go down into the images folder."

../ means up to the parent directory of whatever directory you are starting out in.

cd ../../../ means "Go up 3 levels."

You see, you can only go straight into a folder which resides in the folder you are currently in (a sub-directory). Otherwise you have to spell out the path to the folder.

If you type the following:

cd images/

It will only work if images is a sub-directory of the directory you are currently in.

You can do a search on Google for a good list of Unix commands and maybe a tutorial.

Hope this helps,

Greg

PS- You also can chmod with a path, like this:

chmod 755 ../cgi-bin/*.cgi

Good luck!

_______________________________________
Constructed from 100% recycled electrons
 
Thanks GoBoating and Greg.

Its working on the Solaris box!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

What a feeling of desperation...er.. I mean accomplishment. The system Admin had to set permissions on the directory for me tho because I couldnt do it myself. It was wierd. I had to make a "test" folder called servername.schoolname.edu/~myname....and within that dir make a public_html dir, and in THAT put my test html orm as well as the cgi-bin folder with the script.Then the path he gave me to reference and test the script was servername.schoolname.edu/nerr/cgi-bin/scriptname.cgi
So here is my question. Was that directory NErr an alias? I dont know how it fits in, because when I just typed in to change directories, while telnetting, from servername.schoolname.edu to Nerr... ie cd nerr... i got the error directory not found. Anyway.... Its working now on the solaris box whicch was the most important part... to have it up by the tenth. So to goboating, greg, and everyone else... from Alabama Perl Mongers etc... I really appreciate all the help. I hope everyone has a great holiday season and that you all get many paid snow days from work.... or, as in my case, actually get a paying job.....:)

PS I am going to pick up a sendmail proggie tonite I hope from a friend for the win OS to try and get it working here. I'll be back I am sure, but under no pressure this time.
 
Some aliases are created for security reasons.
cgi-bin scripts are dangerous zones, in security terms.
2 ideas about these things:
* There is a good console program called MC that works as if you where using DOS's NC(norton comander).
* If you have root access you could do:
su httpUsrName
to become 'httpUsrName' (being httpUsrName, the name that uses your server to execute cgi scripts).
Then as that user you could see as if you where the server: try doing :
ls -l *.cgi
to see if your script appears in the list. You could even try at the console a similar script that would answer something without the need of a browser...
 
Don't forget UNIX is case sensitive.

About the nerr directory:

I assume nerr is your name. At any rate, you said it is your directory.

If you telnet in, you are most likely landing in the nerr directory. I assume the server will place you there, it should. Anyway, like I said before, the ONLY way you can get to the nerr directory by typing "cd nerr" is if you are currently in the parent directory of nerr (1 directory above it), otherwise you MUST type the path to it.

Keep in mind that you are always in some directory. ALWAYS.

About cgi-bin: It is common to give users their own cgi-bin. Now any scripts put in their are controlled by you. You should be able to set their permissions.

Some advice: Get a good Unix tutorial book. This is NOT optional. You need a good source of information at your finger tips. Try the public library. Try Amazon.com.

O'Reilly has a good, small, cheap book called "Learning the Unix operating system". It is sitting on my desk right now.

Sam's has a good "Learn Unix in 24 Hrs". It also is on my desk right now.

Good luck,

Greg

_______________________________________
Constructed from 100% recycled electrons
 
Thanks greg I didnt know that UNIX was case sensitive. That may have been the problem. I just bought 4 books on CGI and PERL... sams, the peachpit, sams and OReilly. I will definitely get the UNIX ones you reccomended. Not optional, huh. Thanks again everyone.
WHAT A COUNTRY!!
 
Glad to hear you got some good books. Actually, for some people the books are optional. There's a lot of good info on the web, but finding it is hit & miss. I use both books and the Web extensively.

For some reason I haven't found as much good CGI stuff as I'd like on the Web. There's tons of beginner stuff, and most of it seems to have all been copied from the same source. When you see the exact same examples over and over again, with even the same variable names, you know they aren't writing their own material. It makes you wonder if the people providing it even know any CGI.

The two Unix books I told you about, you don't need to buy them both, since their will be a lot of duplication. I borrowed these (and 3 others) from the libraray.

When it comes to programming, I buy lots of books. I'm a book freak anyway.

Here are 2 tips:

To find which directory you are currently in, type:

pwd

To list the files and subdirectories of the directory you are in, type:

dir

Have fun,

Greg _______________________________________
Constructed from 100% recycled electrons
 
Thanks again Greg. For the tips. My only motivation is to learn to program... in any language. It seems like it will take years to do but I like challenges. As for PERL, I really like it and Unix. I also like MS development tools tho,. What I would really like though is a ground level, comprehensive course or book on boot up to GUI..... whats going on behind the scenes....step by step.... I am starting to learn just by studying up on win2K server stuff... But not really. Any ideas?
 
I'm afraid that's outside my expertise right now. I don't really know much about how operating systems work yet, at least not on a fundamental level, if that's what you mean. I haven't done any systems programming either. I'm not really into networking either, though I did set up a LAN in my apartment just for kicks back in the Spring.

So far the stuff I've done includes developing applications with the following languages/tools:

Visual Basic, SQL, Java, ASP (a little), HTML & CSS, JavaScript (a little), FrontPage, MS Access, Assembler (a little), and currently I'm developing an online forum similar to this one (but simpler) using Perl/CGI & MySQL database running on a Linux server hosted by PHPWebHosting.com (great host!). I'm not bragging though. I have a LOT to learn.

I can recommend excellent books on most of these subjects, plus tell you a few to avoid, if you like. Just tell me what subjects.

The two best books I've found for learning something from the ground up are the following:

Programming with Visual Basic 6.0 by Diane Zak.

CGI/Perl by Diane Zak.

Both are published by Course Technology. See their website. Diane Zak is the best tutorial author on Earth as far as I'm concerned.

If you want more recommendations, let me know.

I love the challenge of programming, though sometimes the debugging drives me buggy!

-Greg

PS- In case you don't know it, you can read book reviews at Amazon.com before buying books. I NEVER fork out money for a book blind. There are just TOO many crappy IT books on the market, and the cash is hard to come by.
_______________________________________
Constructed from 100% recycled electrons
 
Hey Greg. Thanks for the advice. I am interested in how to set up a forum similar to this one related to totally miscellaneous stuff, so any advice you can give on this would be great. Is it a monumental task?? I thought that all these forums were outta the box apps. Is that not the case? Well... either way, maybe you can let me know. Thanks
 
Well, yes, I believe most people probably use outta-the-box forums. In fact, I understand tek-tips is going to start running forums for corporate clients soon.

My original idea was to develop my own, since after all, I am an aspiring programmer & Web dever. I did take a look at a couple of free aps available for download on the free CGI sites(see links below), but I wasn't impressed. I'm sure there are some good ones out there, but I only looked at 2 lame ones. Besides, I wanted to do this as a learning experience. That's what got me started in the first place.


I'm just doing it for fun.

I couldn't find any tutorials for this specifically. In fact, I found almost nothing directly related to this type of project, but after finishing Diane Zak's CGI book, I knew I could figure the rest out.

I spent a few days thinking my way through it, design-wise, and then began coding.

Unless you already have had some exposure to the following, I suggest you go with an outta-the-box app.

HTML, SQL, a decent understanding of how to write computer programs in general, general relational database concepts, and a basic familiarity with Perl (or ASP, or Java/JSP, or PHP, since any of these can be used in place of Perl/CGI).

I wouldn't call this a monumental project, but it's relatively involved, and definitely not a beginner's programming project. It involves many pages of code.

You're doing great, but you can't learn everything at once. God knows I tried. At one point I was taking classes on Java, ASP, and database dev all at once (mistake).

I'm finding that it's taking a lot longer than I thought. But I also like it even more than I thought I would.

Keep up the good work, and just stick with whatever technologies you enjoy. It's all good.

Greg _______________________________________
Constructed from 100% recycled electrons
 
Thanks again, for the links, advie and encourragemnet. I love the fact that computers and programming are both more advanced and complicated than i thought. Im glad that I finally found a profession that I can work at the rest of my life and still not know everything. Isnt that awesome? Anyway, I know what ya mean about learning everything at once. I I learned Basic logic, VB 6, oracle, HTML, Javascript, Java, servelets, applets, JDBC all in 8 months (technically I "learned" it) at chubb and then I spent the next 8 months trying to figure out what i learned ... Now I am concentrating on understanding all the different platforms and I am just about a month away from finally diving into serious programming. I wish i had started when i was 12, but say lah vee.
OK, talk to ya later
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top