cgi newbie

disaster-master's picture

She has: 2,154 posts

Joined: May 2001

I am re-designing a web site that has a counter and guestbook that uses cgi. The counter wasn't working. I tried to fix it by changing the permissions with no success and now the guestbook doesn't work. This is my first time doing this and I know I have done something wrong. I e-mailed earthlink (the host) twice and they were absolutely no help at all. I have read tutorial after tutorial and am getting no where.

Can someone walk me through this?

I am totally ignorant when it comes to the permissions and CHMOD stuff.

disaster-master's picture

She has: 2,154 posts

Joined: May 2001

I have looked at this thread and mairving posted some good info in reply to it. http://www.webmaster-forums.com/showthread.php?threadid=15090&highlight=CHMOD
But how do you chmod? I will be using FTP.

What I did was highlight the cgi/bin on the remote side of FTP and right click it. This brought up the permissions(i guess that is what you call them). I then changed them to what earthlink instructions said to but it didn't work. Is this called chmoding? Or did I leave out a step somewhere?

Here is a link to Earthlinks instructions on how to install a counter. I followed these directions for the text counter and it made the guestbook stop working. Also, I think the cgi/bin has the number of 744 instead of the 755 like they say it is suppossed to be.
earthlink instructions

i hope this gives more info as to exactly what I need help with. Sorry to be so vague in my first post.

mairving's picture

They have: 2,256 posts

Joined: Feb 2001

What FTP program are you using?

disaster-master's picture

She has: 2,154 posts

Joined: May 2001

WS_FTP LE

They have: 601 posts

Joined: Nov 2001

Assuming your web host is running a *ix based server, log in using WS_FTP LE. Right click on the file and/or directory you wish to change permissions for. Select 'chmod (UNIX)' from the drop-down menu and adjust the file's permissions accordingly.

For the 'average' script to work on the 'average' server, select the following checkboxes (in the popup winodws that appears):

x x x
x  
x x x
'

It should return that the file has been chmoded to 755.

That should make it world readable and executable, so it should be able to be run by everyone.

If you have any files that need to be written to (for example log files, message board etc) you will need to chmod them to something like

x x x
x x x
x
'

And the server should return chmod code 766.

Hope this helps.

- wil

disaster-master's picture

She has: 2,154 posts

Joined: May 2001

Thanks Wil. I did that and now I get this on the web page where the counter is suppossed to be. [an error occurred while processing this directive]

It went to 766 but earthlink says it should be 755. What do I need to uncheck?

They have: 601 posts

Joined: Nov 2001

755 is:

x x x
x
x x x
'

766 is:

x x x
x x x
x
'

Have you got access to your error logs?

disaster-master's picture

She has: 2,154 posts

Joined: May 2001

Ok the cgi/bin and counter are both 755 but it still isn't working. How do I do this one?
644 <-rw-r--r-->

disaster-master's picture

She has: 2,154 posts

Joined: May 2001

What would the error logs be under?

disaster-master's picture

She has: 2,154 posts

Joined: May 2001

Ok i have cgi-bin and counter set to 755 and the access-count file is set to 644. It still isn't working.

HELP!!!!!!
Cry

They have: 601 posts

Joined: Nov 2001

Quote: Originally posted by disaster-master
Ok the cgi/bin and counter are both 755 but it still isn't working. How do I do this one?
644 <-rw-r--r-->

Look at what you've got.

r = read
w = write
x = executable

so in this case, using WS_FTP LE you will need:

x x x
x - -
- - -
'

Where did you get this script from? Is this a problem with your SSI call? What is your exact SSI call? Does your web host restrict exec calls from SSI (most do!)?

A little more information would be great Smiling For example, how do you know the code you are working is is valid code? Have you tried accessing the actual page? As in, bypass your SSI call but executing the path that's in the call? Just to make sure it is a SSI problem and not a programming error?

- wil

disaster-master's picture

She has: 2,154 posts

Joined: May 2001

mairving's picture

They have: 2,256 posts

Joined: Feb 2001

Assuming that you have changed permissions on the /cgi-bin directory and the counter to 755 and the guestbook to 644, what kind of errors are you getting?

If it doesn't work at 766, it won't work at 755, since there are less permissions.

Mark Irving
I have a mind like a steel trap; it is rusty and illegal in 47 states

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

To help you better, can you provide a link to the page in question, as well a link to a .txt file of the code you are using?

When you get the [an error occurred while processing this directive] message, there are usually just a couple of reasons:

1. the syntax is wrong in the file being included or executed
2. the file being included or executed isn't where it's supposed to be
3. page and file extensions are not all .shtml

First level you can include .txt files, but anything that has an executable in it has to be .shtml and anything deeper has to be .shtml as well.

Make sure you are using the forward slash in the url as well.

Note of caution, you shouldn't change the permissions for the cgi-bin. If you have, you should get the host to reset them. Just change the permissions for the files themselves, if need be.

Error logs are not normally provided to hosting accounts. If they are, they would be in a logically named folder above the public directory.

What guestbook are you using, also?

Smiling Suzanne

disaster-master's picture

She has: 2,154 posts

Joined: May 2001

ok...i think we may be getting somewhere.

Suzanne when you say that all of the page and file extensions should be .shtml does this mean that you should have index.shtml, index2.shtml, index3.shtml, index4.shtml, etc.??? The current pages are index.shtml, and the rest end with .html or htm.

and you say "link to a .txt file of the code you are using?" There is no .txt file that i can find. What I am seeing in the files on my FTP is a counter folder and inside that ffolder is a file named access_count. It doesn't have .txt at the end. Should it???

I have already changed permissions for the cgi-bin.

After sifting through their files, I find 3 index.shtml.bak. and several of the files have a copy of them with .bak at the end of them too. These are not linked anywhere on the web site that I can find. Haven't got a clue what they are for.

The guestbook came from Earthlink but I believe that they use the code from Matts Script Archive becuause I see reference to that web site in the code.

Geeze...if I get this problem fixed I will have accomplished a great feat!

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Quote: and you say "link to a .txt file of the code you are using?" There is no .txt file that i can find. What I am seeing in the files on my FTP is a counter folder and inside that ffolder is a file named access_count. It doesn't have .txt at the end. Should it???

Oh, gracious, no, there shouldn't be a .txt by default. I mean that you should make a copy of your index.shtml file and name it index.txt so we can view it with all the SSI includes. If we just view source, we'll only see that there is an error, but not if it's in your syntax, et cetera.

Every page that has the counter on it should have a .shtml extension. Not necessarily every page on the site (unless they all have includes or executable directives on them). Do you understand the distinction I'm making? I can give you examples if not.

From your code & earthlink in combination:

You Are Visitor

That's the whole thing.

Is there a folder called "counter" in your /cgi-bin/? From the instructions from Earthlink, you can CHMOD them both to 755. Don't worry if you've already CHMODed the cgi-bin.

Also, you can't check the settings with WS_FTP (LE or Pro) -- it only shows you what setting you last used. So when in doubt, redo it. Re-CHMOD the cgi-bin (since Earthlink allows it, apparently) and the /counter/ directory within the cgi-bin to 755.

The guestbook, though, may need more advanced help, as it's giving me the good old forbidden error.

Smiling Suzanne

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Kenny2 -- you can't see SSI once it's been parsed by the server, so you will never see it by viewing source. Which is why I asked for the raw code.

disaster-master's picture

She has: 2,154 posts

Joined: May 2001

Suzanne,

At least I know that the access_count file is named correctly.Wink

I copied the index.shtml and changed it to index.txt and it doesn't have anything any different from what you see when viewing source. This means that there is some code that is not on the page doesn't it?

I understand about the .shtml extension being only on the pages that you have a guestbook or counter (for example) on.

I am brain-dead now so I think i will let this rest a while and do some more reading on the subject to see if I can grasp something.

All of the posts have been very helpful and even though my problem isn't solved I do have a better understanding of what should be happening.

Hey, I did learn how to CHMOD today! Didn't even know where to begin yesterday.
:jump:

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Do you have this on your page?

<P><FONT COLOR="#FFFFFF" face="veranda" SIZE=+1 >
You Are Visitor <!--#exec cgi="/cgi-bin/counter"--></FONT></P>
'

You must have something like that or it wouldn't show the [an error occurred ...] error message on your page.

If you upload index.txt, I'll be able to see your raw code and maybe see some of the problems.

I know this is frustrating -- it will be until some little thing falls into place and suddenly it will all be oh so clear.

Smiling Suzanne

disaster-master's picture

She has: 2,154 posts

Joined: May 2001

Ok... did I do this right?

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

you did fine!

the code is in place fine, as well.

I want you to do the following:

1. CHMOD the cgi-bin to 755
2. CHMOD the /counter folder within the cgi-bin to 755

Try it again.

If this doesn't work, tell me what files are within the /cgi-bin/counter/ folder.

Smiling Suzanne

disaster-master's picture

She has: 2,154 posts

Joined: May 2001

chmod successful. but counter doesn't work.

I figured screen shots would be better considering there are so many files there.

These are in www/counter folder.

These are in the cgi-bin folder. Lookslike a lot of un-needed stuff to me.

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

http://www.aavfd.org/cgi-bin/counter gives me a 500 internal server error, so I suspect that permissions are what's at fault.

Try what I said above, and if it doesn't work, tell me what's in the folder and I can advise further.

Isn't black box work delightful?

Smiling Suzanne

P.S. WHOOPS! Simulpost, sorry about that. Have you tried a graphic counter?

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

http://www.aavfd.org/cgi-bin/counta

That works.

Try reCHMODing the counter file itself to 755.

Smiling Suzanne

disaster-master's picture

She has: 2,154 posts

Joined: May 2001

Ok I re-chmoded cgi-bin, counter folder and file in counter colder.

Hey that link does work. Now shouldn't that link be somewhere on the index.shtml page?

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

Just curious.. have you edited the counter file at all?

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

you have the default -- counter -- on the index.shtml page.

counta is a variant (from the earthlink file description)...

I can't tell what's going wrong, but the graphic files are working fine, so perhaps choose one of those for now?

I'm off to bed. With the other's working, I think it's time to go back to Earthlink and ask them for assistance.

Smiling Suzanne

P.S. Perhaps in a couple of days we can tackle the guestbook, lol!

disaster-master's picture

She has: 2,154 posts

Joined: May 2001

Hot dang!!!!! WE DID IT!!!!

ok the problem was the file name in the code on the index.shtml page.
It was and should have been

Guess someone who jive talks did that one. HEHEHE!!!

Hey Suzanne, thanks so much for your help. Now I am going to see if the guestbook works.

disaster-master's picture

She has: 2,154 posts

Joined: May 2001

Guest book doen'nt work. I am going to follow the steps that we have done with the counter and if I can't get it I will do it tomorrow.

I owe ya one Suzanne!;0 You don't know how relieved I am.

disaster-master's picture

She has: 2,154 posts

Joined: May 2001

the counter only seems to work when the index.shtml is seen in the address bar. If you type in the other it doesn't show. You can leave that page and come back and it works.

I was reading something about having your index.shtml listed before your index.html in a tutorial. I think it said something about httaccess or someting like that. Am I on the right track with this?

Here is the link where i saw this:

http://www.bignosebird.com/sdocs/enable.shtml

They have: 601 posts

Joined: Nov 2001

Quote: Originally posted by mairving
If it doesn't work at 766, it won't work at 755, since there are less permissions.

No, it's just that one is readable and the other is writeable. Their octal values are a bit misleading IMO.

- wil

They have: 601 posts

Joined: Nov 2001

What files have you got in your home directory?

Have you got a index.html and a index.shtml?

Depending on your server set up, the index.html file will have higher precedence over index.shtml and will be the one displayed to the user. And that's where your problem is. You should never have more than one index file in your directory.

- wil

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

.htaccess should include:

DirectoryIndex index.shtml index.html index.htm
'This line sets the priority of the files. The server will look for index.shtml first. If it can't find it, it will look for index.html, and so forth.

Mark Hensler
If there is no answer on Google, then there is no question.

disaster-master's picture

She has: 2,154 posts

Joined: May 2001

I thought that might be the problem from reading tutorials. This is what is in the htaccess file. The only thing I have altered here for posting are the ***** in the last two lines. Where do I put what you posted above?
Oh, I don't know if it matters or not but I am using dreamweaver. I suppose the person who originally did the site used FP.
_________________
# -FrontPage-

IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*

order deny,allow
deny from all
allow from all

order deny,allow
deny from all

AuthName
AuthUserFile /web/******/******/www/_vti_pvt/service.pwd
AuthGroupFile /web/******/******/www/_vti_pvt/service.grp

disaster-master's picture

She has: 2,154 posts

Joined: May 2001

Also, like I had mentioned earlier in my post, they have three home pages. I have no idea why.

They are index.html, index.shtml and aavfd3.html. I will fix this but just in case you look at the site and notice this.....I am aware of it.

They have: 601 posts

Joined: Nov 2001

Mark

Hmm. Mine was set up (as default installation - version 2) to default to

index.html index.htm home.html home.htm'

I have to explicity state that I want to turn on SSI and that's why it doesn't assume to pick up a directory index for it. Which makes sense...

- wil

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Mark has what you need, just copy what Mark wrote and put it in your .htaccess file and leave the rest untill you know what they are and what they do.

Definitely get rid of the three index pages, that's just going to cause problems. The reason the counter doesn't work on the top domain level is because the default page is index.html, which you now know won't work because it's not parsed by the server.

It doesn't matter if you use Dreamweaver unless they are using some Front Page extensions. From the look of the site, I doubt they are, but if you are cleaning up the code (I recommend you try validating it, for instance), then you will be probably replacing anything that used FP.

___________________________________
# -FrontPage-
IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*
DirectoryIndex index.shtml index.html index.htm

order deny,allow
deny from all
allow from all

order deny,allow
deny from all

AuthName aavfd.org
AuthUserFile /web/******/******/www/_vti_pvt/service.pwd
AuthGroupFile /web/******/******/www/_vti_pvt/service.grp

Also, just a for future reference bit, you can make any page name the default page for a folder using the DirectoryIndex line. I used it to set carterjackson.com/joshua/photogallery/ to photos.php so I wouldn't have to have an index page in that directory, and could keep the photos in their own directory anyway.

Smiling Suzanne

P.S. You don't owe me anything, just keep asking questions and helping! Wink Glad you got the bits working. Now about that guestbook, I recommend you wander to the scripting languages forum and post about it. List the script name, including a link to the source code if applicable, and where you are trying to get it to work, and what, specifically, your errors are. Someone there will be able to steer you in the right direction, hopefully.

disaster-master's picture

She has: 2,154 posts

Joined: May 2001

Thanks guys and Suzanne. I changed the htaccess file and now it goes to the .shtml page. The counter works and the guestbook works.

Now I can concentrate on building new pages and changing everything over.

You all are life savers!!!
And good teachers.Smiling

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

Quote: Originally posted by Wil
Mark

Hmm. Mine was set up (as default installation - version 2) to default to

version 2 of what? Are you running Apache 2? *drool* I've read a bit about it, but I'm going to wait for it to come out of beta before I install it.

Mark Hensler
If there is no answer on Google, then there is no question.

They have: 601 posts

Joined: Nov 2001

Yeah, running Apache 2 - but only on my local box!! My actual hosting provider is still stuck in the 90's .. even running perl 5.005_03 (1997)!! Sad At least it's stable though, they are waiting for the next release of woody (I think).

Cheers

- wil

disaster-master's picture

She has: 2,154 posts

Joined: May 2001

How can i get an image to show up in this guestbook? Do I need to put the image in another file also like the guest book file or the cgi-bin file?

All I can see are the place holders for the image. The code is there.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.