
|
View Full Version : CGI/Perl Anyone?
philman213 09-29-2004, 11:45 PM Need help with some very simple CGI. I use Apache 2, on windows XP home, SP2 (doesnt matter though). In my html file, with my form, I have:
<FORM method="post" Action="./cgi-bin/gb.cgi">
I know this is incorrect, and that action should equal http://www.server.com/whatever/gb.cgi, or something along those lines. What I dont understand is, how Im suppose to do that. For me to be able to point to my cgibin, I would have to put it in my accessible server, meaning if you went www.server.com/cgi-bin, you would see all my cgis. Thats the only way I can think off to make me able to point my HTML to my CGI. I have also been told though that you shouldnt have your CGI bin accessible to the web.
Help. :rolleyes:
YUPAPA 09-30-2004, 12:01 AM Are you trying to show all the content (all the files) under the cgi-bin?
BTW, this is ok to have: <FORM method="post" Action="./cgi-bin/gb.cgi">
philman213 09-30-2004, 12:10 AM I dont understand what you mean?
I was told it must be http://, not c:\ or ./whatever
Mr. Obvious 09-30-2004, 12:13 AM Not quite up to speed with cgi, but what if you did <FORM method="post action="cgi-bin/gb.cgi">
philman213 09-30-2004, 12:16 AM That wouldnt do anything. :\
YUPAPA 09-30-2004, 12:18 AM Simply just store the html and the cgi files to the same folder.
And then put <FORM METHOD="POST" ACTION="./my_file.cgi">
Mr. Obvious 09-30-2004, 12:20 AM Its better to put them in the cgi-bin folder though :D
philman213 09-30-2004, 12:20 AM Your not suppose to but cgi files like that. Im afriad you dont understand CGI basics.
YUPAPA 09-30-2004, 12:23 AM I don't understand CGI basics?? :stickout:
I code CGI scripts my friend~
I actually dont quite understand the problem you are explainning.
What kind of errors are you getting?
philman213 09-30-2004, 12:25 AM Well you skipped a class or two :stickout:
CGIs are special, they dont go with all the other html and css or whatever files. They go in a special folder for special things. :)
They arnt meant to be mixed with html files.
YUPAPA 09-30-2004, 12:26 AM Well yes you can. However, you can make CGI/Perl script runs everywhere other than in your cgi-bin directory.
philman213 09-30-2004, 12:31 AM Okay recap.
In my HTML file, I need to specify where the CGI file is so I get that cute little email. I have been told that you need to specify where that cgi is with http://www.whatever.com/blueturtle/redballoon.cgi
Therefore, following this set of rules, I would need my cgi-bin folder accessible to the world, which goes against my other set of rules that says your not suppose to have your cgi files accessible.
Therefore, the only solution to go by both rules would be to go with http://www.whatever.com/./cgi-bin/redballoon.cgi
That would work fine, IF, ./ was allowed in a URL, but it is not. It is allowed in HTML, but you cant put that in a URL. So I dont know how to fix.
Mr. Obvious 09-30-2004, 12:37 AM phil, contact me on msn, ill try to help ya :) (frostedpoptart[at]hotmail[dot]com)
YUPAPA 09-30-2004, 12:40 AM If your cgi-bin folder isn't accessible to the world, how are you going to run scripts that are stored in the cgi-bin?
Why do you need the ./ ?
http://www.whatever.com/./cgi-bin/redballoon.cgi is equal to http://www.whatever.com/cgi-bin/redballoon.cgi
[ADDED]
I think I have to give up. I have read it more than 5 times for more than 10 minutes and I still can't get what you are trying to do. I first thought it was about apache indexes, ScriptDir, etc... but no idea~ :stickout:
Hope ElectricHosting can help you~ :)
Mr. Obvious 09-30-2004, 01:03 AM Your cgi-bin folder by default is not accessible to the world :)
Also, phil, if you dont have msn, get me on aim @ electricwebs :) or my icq number, but i forgoted it :D
philman213 09-30-2004, 01:09 AM No, they are different. The first one would bump up to the above folder and then to the cgi bin. Maybe a picture could help...
This first one shows how my apache is set up. Only the files inside the htdocs folder are accessible by the web. All those other files, no one knows they exist but me and whoever views this picture. This means that my cgibin folder and cgi files arnt accessible by the web.
http://www.themexicanjob.com/images/apache1.jpg
For www.themexicanjob.com/cgi-bin to work, I would have to move my cgibin into my htdocs folder. I think apache would have a **** fit if I did that.
http://www.themexicanjob.com/images/apache2.jpg
Edit: errrr..... I just checked http://www.themexicanjob.com/./images, and it works, basically meaning that..I solved my problem I think..disregard if you are still confused :rolleyes:
Website Rob 09-30-2004, 01:19 AM Phil, the rule is that the path to your 'cgi-bin' and script, must be correct from where the web page is (relative) or from beginning of partition (absolute).
Example:
You have your public files in a directory called 'public_html' or maybe 'www' and you also have a Web page called form.html.
public_html/form.html
The script path in the Form page would then be: form action="cgi-bin/redballoon.cgi"
If you had your Form page in another dir. one level down:
public_html/directory/form.html
The script path in the Form page would then be: form action="../cgi-bin/redballoon.cgi"
The above are called relative links. When in doubt or having problems you can use an absolute link. In this case you would use Windows Explorer or My Computer and go to the partiition you have Apache installed on. The go to your 'home' directory, then your account dir, then 'public_html/cgi-bin'.
Now, copy the whole path as shown in the Address bar. Add the script name on the end and use that as an absolute path for the: form action= part.
The reason some have said start with c:\ is that most people only have one partition on their hard drive, which is called 'c' and that may not be that case for you. I don't use Apache with Windows so not sure if you need to forward slashes or back slashes.
Edit: hadn't seen that last post and looks like you've solved the problem. Good troubleshooting. ;)
philman213 09-30-2004, 01:31 AM Sorry but your post didnt make any sense to me. :P Oh well, im really tired, maybe it will tomarrow. Thanks anyway.
|