PDA

View Full Version : cgi-bin question


iuwfonline
1-7-02, 03:50 AM
When I am installing a script in the cgi-bin, most scripts tell you to make a new folder within the cgi-bin, I make a new folder in the cgi-bin and CHMOD the folder correctly. But the script does not work.

But when I put the script in the actual cgi-bin not within a folder, it does work.

Does anyone know why the script does not work in a folder within the cgi-bin?

SimCoWeb
1-7-02, 04:52 AM
It's most likely because you didn't set the path correctly when you placed it into a sub-directory under your cgi-bin. If you chmod the new directory AND the script, set the proper path to perl, and also your paths in the config portion of the script then it should work no problem.

If it's working inside the cgi-bin but not in the sub directory you created then it simply isn't finding the script. Be sure your path is like:

/www/?/yourusername/cgi-bin/subdirname/nameofscript.cgi

The reason for creating a new directory in your cgi-bin for each script is simple. Once you start installing multiple scripts you'll find that many of the files are named the same. To avoid the existing ones from being 'overwritten' you need to organize your cgi-bin using sub-directories. Otherwise, you'll have a huge messarooski on your hands :)

You'll notice it's the same principle under your /htdocs directory. There may be an /images directory, /members directory etc. to help organize your files.

fcsnc
1-7-02, 06:14 AM
The most common problem with scripts on powweb is the following:

YOU MUST NOT HAVE WRITE PERMISSIONS SET ON THE SCRIPT FOR ANYONE EXCEPT YOURSELF (THE OWNER).

Perl scripts on Powweb run with suid set to the owner of the webspace in which the script resides. A security check is done to make sure that nobody except the owner has write permissions to the script. Otherwise ... in theory ... someone other than you could overwrite your script with their own script of the same name and execute it ... doing terrible things.

If this security check fails, you get the old 500 error.

The permissions don't HAVE to be 755 for your script. They can be 500. They only have to be executable ... not even writeable by you unless the script likes to rewrite itself all the time.

Furthermore--in spite of what the instructions say in the script that you download from somewhere, you don't have to make anything 777. Not only does this make your file / directory WORLD-writeable (a huge security risk), it's not necessary. Because your script runs AS YOU, it can update or create files anywhere in your webspace all by its lonesome.

Tubba
1-7-02, 12:22 PM
Don't forget to chmod the *directory* as well as the script. I kept making that mistake, too.