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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I excecute a CGI script 1

Status
Not open for further replies.

eekthecat

Programmer
Nov 13, 2000
45
0
0
US
Hi,

I'm just testing local on my machine. I've got a CGI mail script. When I'm posting a form to the CGI script I get a page not found error. What should I do...
Do I need a special enviroment such as Appache?

Thanx
 
Yes, you need to have your CGI script on a webserver in order for it to perform CGI. If you just want to run the code, then you could do it locally if you have a compiler or interpreter on your machine for your language.
Sincerely,

Tom Anderson
CEO, Order amid Chaos, Inc.
 
What sort of compiler / interpreter do I need?
 
The one for the language you are using! If you are using C, get a C compiler. If you are using Perl, get a Perl interpreter. Et cetera. These things come standard in linux (eg. perl yourscript.pl, gcc yourscript.c, etc.). I suggest you consult some basic tutorials in CGI and the language of your choice.
Sincerely,

Tom Anderson
CEO, Order amid Chaos, Inc.
 
Hi I'm back again.
I've got a compiler for Perl.
It works fine when I type

perl search.pl (that's the file i want to excecute)

But when I want to test it local with my webserver it doesn't work.

I've got a form witch posts the results from that form to the search.pl file. When I post the form my Internet explorer gives an HTTP 501/505 error. It sais: " not implemented or not intergrated" (or something like that because my browser is dutch).

How can I make it work?

Eek
 
Good morning eek,

You do need Apache. (get away from PWS.) You do not need a compiler to get Apache to work. Just download the appropriate port for you OS (?Win98?) and follow the readme file and associated documentation/instructions.

If you have Perl and did not get it from ActiveState, get the activeState port for Win98 and install that. It is a simple download and double-click scenario.
Are you dutch? If not, until you get Apache running/working the way you want, do your testing with Netscape or IE. Once you can get simple CGIs working, throw the dutch browser into the mix and go from there. If you are dutch, I would still try the same, ....' means reading a little more english.

'hope this helps.....





keep the rudder amid ship and beware the odd typo
 
Hi,

Yes, i'm dutch. You could problably notice my bad english. Well the thing is... i'm at the end of my ... how do you call it in english (stageperiode) so i haven't got much time left. I don't have the time to setup and experiment with appache in ordere to excecute cgi files. I still need to build a search function... I think it's better to leave the CGI and go find something like a java programme to search my website.

Thanks anyway, it's been a great help for sure.

Eek
 
Eek, Java is NOT as web language, though some people try hard to make it one. CGI is the way to go. Where are you serving your website from? Test it on your webserver from a non-public directory.
Sincerely,

Tom Anderson
CEO, Order amid Chaos, Inc.
 
Eek,
I agree with Tom. There is not an easier, more flexible, or more powerful way to do CGI than Perl. I don't think Perl is your problem, anyway. It does not matter what language you write your CGI code in if you can't figure out how to work with the web server. When you get the web server trick figured out, you can write your CGI in any language that will obey the rules of CGI. After all, CGI is just a set of rules. If you obey those rules, you can get web servers to do things for you. I understand your under some time constraints, but, get a very simple CGI script to work so you can demonstrate that your web server is doing its job. Then, you can develop the basic CGI pattern to do anything you want.

a most basic piece of CGI..... change the first line to point at your Perl.
Code:
#!/usr/local/bin/perl
print "Content-type: text/html\n\n";
print &quot;<HTML><HEAD><TITLE>A NEW CGI PAGE</TITLE></HEAD>\n&quot;;
print &quot;<BODY><P>Here is the text I want to see</P></BODY></HTML>&quot;;

Put this in your 'cgi-bin' or equivalent (the place where you web server expects CGI code to live). Set the execute bits if you are on a UNIX box. Get your web server to execute this most simple CGI and you are on your way.

I seem to remember ( from another post) that you are using Windows Personal Web Server. The only thing I have ever done with that is delete it from my machine, so, I can't be of any assistance with that. I do remember seeing some old posts on the PWS subject. You might go looking back a few months to see if you can find them. However, if you go the Apache route, there are several in TT that will be able to assist.

good luck. I hope this helps.




keep the rudder amid ship and beware the odd typo
 
Just thought I'd throw some more batter into the mix. Eek, if you don't have time or the resources to play with Apache, then sign up for a Free Webhosting Account with someone who does. You should be able to find several on the web, is the largest I know of. They already have CGI bin implemented with PERL 5. I do most of my coding on my own machine and upload it to Hypermart for testing and will do until the Apache server is ready.

Jonathan Jonathan Hannan
Computer Repair, Webdesign
HTML, CGI, PERL, JavaScript, XML
 
Or, hey, here's an idea... you could PAY for your hosting. $10/month will buy you about 25 megs of disk space, and you don't have to bother with advertising or any other hassles. It's a good investment for less than the cost of a cup of coffee per day.
Sincerely,

Tom Anderson
CEO, Order amid Chaos, Inc.
 
That's a real good idea. Just make sure that the ISP you use supports all modules for CGI. I use SWBell for another site I'm working on and they don't support some of the higher level modules...so I'm back to hypermart. :p Jonathan Hannan
Computer Repair, Webdesign
HTML, CGI, PERL, JavaScript, XML
 
I suggest against using either ISPs or advertising-based hosts. Instead, use a real hosting company which does support everything you need to do, including telnet accounts, ftp, every server-side language you could need, etc. My company does offer this, but I'm not going to solicit in the forum; instead, I'll point you to a competitor I respect: . You can get cheap shared-server accounts (like ISPs and free hosts provide, but with more access and control), or you could pay around $200/month for a full dedicated server which you have complete control over... you could recompile the operating system if you wanted.

I wish people would get out of the mindset that things have to be free on the internet, or that free is better... well, you get what you pay for.
Sincerely,

Tom Anderson
CEO, Order amid Chaos, Inc.
 
I just thought that I might like to throw this in:

Since Perl was not developed to be a CGI language, I do not consider it the best. So far, with the ones I have developed with, I have found PHP to be the best. PHP interaction with almost any SQL dbase is amazing, and since it was developed soley for CGI purposes, not as a console language as Perl was, it is number one on my list.

Don't get me wrong, Perl is an incredible language, just not for CGI.

Just wanted to add my two cents.

-Vic

vic cherubini
malice365@hotmail.com
====

Knows: Perl, HTML, JavScript, C/C++, PHP, Flash, Director

Wants to Know: Java, Cold Fusion, Tcl/TK

====
 
vikter, just my two cents, but you are nuts ;-) You can't judge the usefulness of a language by what it was originally designed to do. You have to judge it on what it actually does do! And I don't believe that Perl was designed to be a &quot;console&quot; language per se. The Perl philosophy is that there is more than one way to do things, so I'm not going to tell you that Perl is the ultimate solution for everything, but it sure is a damned good one for lots of stuff, including CGI. Perl's DBI module could match PHP in database interaction any day. Perl can also do many things PHP cannot. If you're working with a unix filesystem or parsing text, then Perl is definitely the way to go. Now, I won't advocate Perl as the solution for everyone in every situation necessarily, but everyone should consider it strongly for any problem. Personally, I think mod-perl apache and mysql on linux is the ultimate web environment.
Sincerely,

Tom Anderson
CEO, Order amid Chaos, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top