OT: Getting CGI/Perl to run on a hard drive

Started by phillip, July 16, 2004, 01:13:04 PM

Previous topic - Next topic

phillip

Is there a way to get CGI/Perl scripts to run on the hard drive of my computer?  I'd like to see how they'd look and work when I finally get a ".com" for Fuzz Central.

TIA!
Phillip

cd

Quote from: phillipIs there a way to get CGI/Perl scripts to run on the hard drive of my computer?  I'd like to see how they'd look and work when I finally get a ".com" for Fuzz Central.

TIA!
Phillip

You need to be running a webserver that supports CGI/Perl.

phillip

Quote from: cdYou need to be running a webserver that supports CGI/Perl.

Do you know of a good one?  I don't know if Apache supports Perl or not...I'm not very up to date on web server software.

Phillip

cd

Yup, Apache supports Perl.  What OS are you using?  If you're on Mac OS X, you can change two characters in a text file and have a full Perl/CGI Apache up and running.

phillip

I'm using Win XP.  So Apache can actually operate on my hard drive and let me simulate how Perl will look on an actual web server once uploaded?

Phillip

spongebob

A local Apache server is a nice way to test your Perl/PHP/etc. scripts without uploading them to your webserver, you just save the script in the editor and refresh your browser window, that's pretty cool for debugging!

You can get Apache from here: http://httpd.apache.org/download.cgi

I'm not sure if Perl is included with Apache these days, but if not you can download it from here: http://www.activestate.com/Products/Download/Download.plex?id=ActivePerl

You might have to fiddle around with various config files so that perl files are recognized as CGI scripts, but hopefully the installer will take care of that...

phillip

How should I save it on my hard drive?  Should it be save like any other program, in the "c:\program files" folder?  I'm a bit new to the server stuff ;)

Phillip

travissk

Yes, you will install it to someplace like program files, and it will start up as a systems process, running in the background of your computer.

When it's active, it will listen in on port 80 (or whatever you configure, 80 is the standard). Your computer will have some IP address, 127.0.0.1 or localhost should work.

Apache has a directory (httpdocs or something, again this is easily modified)  that you can put your pages in, and that becomes the root of your website. For instance, you might set the site_root to c:\mysite\site1, and you put "mypage.html" in that folder.

Then, you open up a browser and type in
http://(your computer's ip address)/mypage.html

or maybe http://localhost/mypage.html

Then apache will recognize there's an incoming connection on port 80 (default), see that you want mypage.html, grab it from your site's root folder on your hard drive, and feed it to your browser. With perl on, it will do its server-side CGI dance and then throw your browser the result.

a couple possible problems if something goes wrong:
-You have a firewall that needs to be modified.
-You're behind a router and are using the router's IP address.

Apache is very easy to set up; I have a copy running on my computer at school (which is in storage at the moment) and it took something like 5 minutes to get up and running.

phillip

Which version would I need to download?  Keep in mind that I have no previous experience with Apache ;)

-Win32 Source
-Win32 Binary (MSI Installer)

Phillip

spongebob

:arrow: Win32 Binary Installer version, you don't need the source code.

Peter Snowberg

Apache supports Perl very well, but I wouldn't advise anybody to go the Perl way these days. PHP is just a TON better, easier to use, more supported, has a better user community, and is much much much better integrated with HTML for web applications. By comparison, Perl is a never-ending nightmare while PHP is a great dream.

Even Larry Wall (Perl's author) says that Perl stands for 'Pathologically Eclectic Rubbish Lister'. :D You can do great things with it, but it's old clunky technology now.

There are multiple packages that will install PHP, Apache, MySQL, and phpMyAdmin in one easy pass but you must be running windows 2000 or XP for most of these. I use a package from E_Novative in Germany called WAMP. If you saw the "Where are you" thread, that was running on WAMP. I also run a copy of the forum software here and a bunch of other little code snippits, some with SQL databases on the back end. WAMP just runs flawlessly. 8)

PHP is a fantastic language! :D :D :D

http://docbook.e-novative.de/en/software/wamp.php

BTW: This is one of the most painless installers ever. :D

Take care,
-Peter
Eschew paradigm obfuscation

javacody

Windows XP also comes with IIS. You can simply download the Active State PERL program and it will install itself to IIS. I love apache, but it may be easier for someone new to all of this to just use IIS.

Peter is right about PHP. It roxors.  ;)   There is also a PHP installer that should install itself automatically to IIS. PHP also seems to perform quite a bit better than PERL, and I find it far easier to program and read/understand other folks' code. The problem with PERL is that it is a combination of about 5 other languages. You can write the same functionality about 100 different ways in PERL. This is great if you only ever right original stuff, but 90% of the time, someone has already written something close to what you want and you might want to tweak it a bit. This is very hard to do for a beginner with PERL.

If you still want to go with Apache, I'm sure there are a few real good tutorials out there that can help you get it up and running. If you are somewhat technically minded then I would recommend Apache. It definitely has a cooler name and is known for stability.  :)

aron

Perl is a never-ending nightmare while PHP is a great dream.

OK, I'm tossing my PERL book and getting a PHP book.

Thanks!

Aron

phillip

Most of the stuff that I'd be using would be pre-written scripts like  a Guestbook (which I already have running on Tripod), a polling script, and some SSI stuff that would allow me to insert a single footer (and maybe header) HTML file at the bottom of every page, so that I could easily customize it by editing one file, and the change would be reflected on all the pages of the site.

I'm wondering...can the footer thing be done with Java in any way?

Phillip

Bent Penguin

Quote from: phillip
I'm wondering...can the footer thing be done with Java in any way?

Phillip[/color]
It's trivial in PHP if you go that way. You have a file called something like footer.php and then in the middle of your HTML  you just add

<?php
include 'footer.php';
?>

Peter Snowberg

Quote from: phillipI'm wondering...can the footer thing be done with Java in any way?

Phillip
No.

Java and Flash are two technologies that operate totally on the client side. The web server in the case of these web extensions is only a file server. Neither Java nor flash are able to interact with the page building process directly on the server end. There is a version of Java that does run on the server, but after my dealings with Java's bugs in the past I'll never touch that language again. Yuck!

There is no denying that Java is the most flexible and fastest environment for writing client-side applications that run inside a rectangular box, but it can't do footers. ;)

As Bent Penguin showed, it's trivial to do in PHP. (however you can't draw a fractal with PHP using the client's CPU)

For a serious heavy duty web technology based system, the combination of PHP and MySQL for a back-end, and Java or Flash for a front-end can yield some amazing results, but for most things PHP, HTML, and JavaScript get the job done with ease.

for some PHP references.....

http://www.php.net
http://www.phpbuilder.com
http://www.evilwalrus.com

for on-line help with commands...

http://php.net/print (or any other command name you want to look up)

The only file extension I use for web pages now is .php (no .html, .asp, or .shtml anymore). Even if there is no need for php in the document at that time... ;)

Take care,
-Peter
Eschew paradigm obfuscation

Bent Penguin

Just to avoid some confusion for those of you who's web skills are at the level of my pedal skills ;) Java and Javascript are 2 different things. Java is a programming language somewhat similar to C++ and Javascript is more of a library of commands that a brower understands, they used the name javascript to ride the java buzz, very lame marketing tool.

javacody

Sheesh Peter, you are knocking my bread and butter, man.  ;)  How long ago did you try Java, 1995?  LOL  It's very stable now. Applets still suck, but Server Side stuff is rock solid. JSP's even almost rival PHP for simplicity.

You may also do an include with JavaScript where you read a txt file off the server and do a document.write on it. SSI and PHP are both much easier/better ways of doing that.

For a bit of history for you guys that don't know the history, JavaScript was a partnership between Sun and Netscape at the height of the Browser wars and the height of Sun's battle with Microsoft. Hence the name JavaScript, as "Java" became a dirty word at Microsoft. To add insult to injury, Netscape sold the W3C (web standards board basically) on JavaScript as a standard, but they called it something else (can't remember right now) and Microsoft signed up not knowing it was "JavaScript". When they found out, they were pissed. LOL So they named their version JScript. HA HA HA. Evil bastards.  ;)

Peter Snowberg

Quote from: javacodySheesh Peter, you are knocking my bread and butter, man.  ;)  How long ago did you try Java, 1995?  LOL  It's very stable now. Applets still suck, but Server Side stuff is rock solid.
No offence Cody. :D I did a streaming video receiver in 1998 and a full featured point of sale system in 1999-2000 that connected to a backend written in Perl & SQL.

From the author of J-Track at NASA in 1999, "JAVA truly is the great equalizing software. It has reduced all computers to mediocrity and buggyness." From my experiences I couldn't agree more. Sorry. It left a bad enough taste in my mouth that I'm not going there again unless under duress. :D Hehehe.

Take care,
-Peter
Eschew paradigm obfuscation

javacody

Ahh, but that is ancient history in computerland, isn't it.  :)  We have computers that are 4 to 5 times faster, memory is cheaper and faster than ever, and Sun has improved Java significantly. I didn't learn Java for a long time because I'd heard similar opinions. But PHP is still an awesome language for web based stuff.  :) In Java's defense, I've heard plenty of COBOL programmers knock C++ and OOP.  LOL  Everything has to learn how to crawl before it can run, especially infant programming languages.