View previous topic :: View next topic |
Author |
Message |
garyanderson -
Joined: 08 Apr 2004 Posts: 40
|
Posted: Thu Apr 15, 2004 10:21 pm Post subject: no cgi bin |
|
|
I attempted to put my form processing program in the cgi bin and renamed my program with a .cgi extension. however it could not find the path specified or something because it only returned my sourcecode. So i simply placed my processing program in an a relative path to the program - that is in the htmldocs folder and everything works fine.
My question is is there a security risk with doing this. or not putting it in the cgi-bin. is it necessarily wrong or something? I'm using python to do my form processing and using abyss to let me see how it handles the forms. Will there be some conflict when i upload it to my webhost?
Thank you very much. |
|
Back to top |
|
|
TRUSTAbyss -
Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
|
Posted: Thu Apr 15, 2004 11:18 pm Post subject: |
|
|
I never got python to work with abyss , I don't even know if its
a security issue but can you explain how to install python.
It may be possible to create a Python
version of ::Virtual Host Creator:: 8)
-------------------------------------------------------------------------------------
On Abyss , any cgi program can run outside the cgi
bin so that should not be a problem , Hope this helps! |
|
Back to top |
|
|
garyanderson -
Joined: 08 Apr 2004 Posts: 40
|
Posted: Fri Apr 16, 2004 4:10 am Post subject: |
|
|
good to know.
------------------------------
To install python install like you would do any other language interpereter.
1)download the interpreter
2)in abyss go to : > Home > Server Configuration > Advanced > CGI Parameters
3) make sure botht these options are set to yes:
Resolve interpreter using the Windows Registry: yes
Resolve interpreter using the script's #! line: yes
this will have windows search for the path of the interpreter
and make sure the interpreter reads after the #! line
make sure in the cgi interperters section it says something like:
C:\Python23\python.exe py
and that should be it shouldn't be a problem.
Glad to know there is another python fan on the board. let me know if you have any problems.
:wink: |
|
Back to top |
|
|
aprelium -
Joined: 22 Mar 2002 Posts: 6800
|
Posted: Fri Apr 16, 2004 3:20 pm Post subject: Re: no cgi bin |
|
|
garyanderson,
There is no security risk if your CGI parameters (and your CGI Paths) are correctly set up.
But we recommend setting:
Resolve interpreter using the Windows Registry: No
Resolve interpreter using the script's #! line: No
This will speed up the processing of your CGI pages as Abyss will only rely on the extension to know what interpreter to use. Of course, you should set the Associated extensions with Python to "py cgi" (py space cgi).
By the way, we too are Python fans.
TrustPunk, what's the problem with Python? _________________ Support Team
Aprelium - http://www.aprelium.com |
|
Back to top |
|
|
garyanderson -
Joined: 08 Apr 2004 Posts: 40
|
Posted: Fri Apr 16, 2004 6:14 pm Post subject: |
|
|
Thank you for your reply. Howver is it necessarily wrong though if the application processing the form is not in the cgi bin? or is it okay if its in the htmldocs section and with a .py ext and not .cgi. I actually likethis better as i can modify it quicker.
Thank you. |
|
Back to top |
|
|
TRUSTAbyss -
Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
|
Posted: Sat Apr 17, 2004 5:24 am Post subject: |
|
|
Edit: I got Python working , no more screenshots,
Last edited by TRUSTAbyss on Thu Mar 24, 2005 9:11 am; edited 1 time in total |
|
Back to top |
|
|
Anonymoose -
Joined: 09 Sep 2003 Posts: 2192
|
Posted: Sat Apr 17, 2004 8:30 am Post subject: |
|
|
Trustpunk, are you sure Perl and Python can both share the .cgi extension? If you have resolve interpreter using script's #! line set to no, there'll be no way for Abyss to choose the correct interpreter...
Do .py files work ? |
|
Back to top |
|
|
TRUSTAbyss -
Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
|
Posted: Sat Apr 17, 2004 9:18 am Post subject: |
|
|
Quote: | garyanderson,
There is no security risk if your CGI parameters (and your CGI Paths) are correctly set up.
But we recommend setting:
Resolve interpreter using the Windows Registry: No
Resolve interpreter using the script's #! line: No
This will speed up the processing of your CGI pages as Abyss will only rely on the extension to know what interpreter to use. Of course, you should set the Associated extensions with Python to "py cgi" (py space cgi).
By the way, we too are Python fans.
TrustPunk, what's the problem with Python?
|
Have you read what Aprelium Recommends ? |
|
Back to top |
|
|
garyanderson -
Joined: 08 Apr 2004 Posts: 40
|
Posted: Sat Apr 17, 2004 11:00 pm Post subject: |
|
|
hope it works for you punk. I only use python as my interperter for cgi so i don't know if there is a conflict of sorts with abyss when it has to go to perl or to python.
one question. if you use perl or pyhton for cgi, why do you have to rename the script with a .cgi extension. is it for security reasons so ppl can't see what program your using for processingand hack you? otherwise i don't really see a reason. and why place it in the cgi bin, isn't that just confusing? then you have to change your path in your script to \cgi-bin\parser.cg it just seems a lot of work for no reason. Of course i'm a web newbie so i'll be spouting off a lot. Thanks for the replies
With python I can print out the html page or use the location mime to redirect the web page? I just find all of these unecessary thats why, let me know if i'm wrong. Thankslol: |
|
Back to top |
|
|
Anonymoose -
Joined: 09 Sep 2003 Posts: 2192
|
Posted: Sun Apr 18, 2004 12:35 am Post subject: |
|
|
TRUSTpunk wrote: | Have you read what Aprelium Recommends ? |
They may have been assuming you were only running one scripting language on your server. For hosting a personal site, most people do not need to install Perl, Python, ASP and PHP at the same time... |
|
Back to top |
|
|
aprelium -
Joined: 22 Mar 2002 Posts: 6800
|
Posted: Sun Apr 18, 2004 4:50 pm Post subject: |
|
|
garyanderson,
Using .cgi and cgi-bin is not mandatory. That's mainly a legacy from the early web servers (in the 90s) where security was rudimentary and where scripts needed to be located in a single directory. _________________ Support Team
Aprelium - http://www.aprelium.com |
|
Back to top |
|
|
garyanderson -
Joined: 08 Apr 2004 Posts: 40
|
Posted: Sun Apr 18, 2004 9:04 pm Post subject: |
|
|
OH, Thank you so much apprelium. I really was wondering if it was a security issue or somthing. Thank you for answering. I really am impressed with python so I wouldn't mind showing it off to the world. That language should be bigger thatn it is now, Maybe you guys should add a python forum. I noticed you had perl, asp and something else. I did a search on here and I noticed a lot of ppl are interested in Python. I would love to contribute some of my scripts to help out. anyway i can.
Abyss OWNS!!! EXCELLENT WORK!!! |
|
Back to top |
|
|
iNaNimAtE -
Joined: 05 Nov 2003 Posts: 2381 Location: Everywhere you're not.
|
Posted: Sun Apr 18, 2004 9:22 pm Post subject: |
|
|
So what about the whole idea that the /cgi-bin directory has to be out of the root directory? _________________ Bienvenidos! |
|
Back to top |
|
|
TRUSTAbyss -
Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
|
Posted: Mon Apr 19, 2004 7:11 am Post subject: |
|
|
Edit: Here's a good Python script to test if Python is working.
Hello World!
Code: |
print "Content-Type: text/html\n"
print "Hello World!" |
Last edited by TRUSTAbyss on Thu Mar 24, 2005 9:12 am; edited 1 time in total |
|
Back to top |
|
|
garyanderson -
Joined: 08 Apr 2004 Posts: 40
|
Posted: Mon Apr 19, 2004 2:45 pm Post subject: |
|
|
congratulations punk i'm glad you got it working. Next time we'll ask you to post code. I've realised when dealing with computers the answers to the questions are usally really simple.
Your right the cgi.tes() method is an excellent method to check if everything is working properly. If you know python at all you can do pretty much everything for cgi. You might even give up perl.
al python cgi scripst begin with the following Code: | import cgi
import cgitb; cgitb.enable()
form = cgi.FieldStorage() |
and thats it!! cgitb is a cgi tracback class that will point out any errors when your scripts don't work. use this to build the forms then remove when your script is working fine.
calling the fieldstorage method invokes form to be of a dictionary type (I don't know if you have those in perl, they are called hash in other languages)
once you have your form, you access you can manipulate like so Code: | input=form.getvalue("name","N/A") | where getvalue gets the value of the name key and returns it, if its not there, then "N/A" will print instead.
when your ready to output html then simply Code: | print "Content-type: text/html"
print
print <tags>text</tags> |
note python supports th location mime type as well
anyway to make a short story long: d
1st make sure your using python 2.3 that is the latest.
note that not all of the dictionary methods are supported by the cgi module - an annoyance i think they should fix in later releases.
for more detailed info about using the cgi module go to python manuals> index>cgi. you'll find a plethora of info. Trust me you'll llove it.
to see what ptython can do with cgi check
http://aspn.activestate.com/ASPN/Cookbook/Python?kwd=CGI%20Programming
HAVE FUN!! |
|
Back to top |
|
|
iNaNimAtE -
Joined: 05 Nov 2003 Posts: 2381 Location: Everywhere you're not.
|
|
Back to top |
|
|
MUGH8506 -
Joined: 14 Jun 2004 Posts: 72 Location: Hell
|
Posted: Fri Jul 09, 2004 6:07 pm Post subject: |
|
|
What is "cgibin"? Is this a server side or what? _________________
http://www.trustabyss.com/ |
|
Back to top |
|
|
TRUSTAbyss -
Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
|
Posted: Fri Jul 09, 2004 6:16 pm Post subject: |
|
|
The cgi-bin is where you keep your Perl scripts , if you have the new
2.0 Beta 1 , you don't have to worry about the cgi-bin because its not
included in the package , also 1.2 doesn't need a cgi-bin now.
Welcome to the year 2004 ! |
|
Back to top |
|
|
MUGH8506 -
Joined: 14 Jun 2004 Posts: 72 Location: Hell
|
|
Back to top |
|
|
|