Running ActivePerl Win32
Hello. I have recently installed activeperl for windows and have attempted to write some scripts. But when I access the .cgi files the browser displays the entire code..and the script never executes. I figured it was because of my shebang but I am positive I have it pointed correctly. Has anyone had any experience with this sorta thing? Thanx for the help.
VulKen
Pimpin like a pimp with an electrofied pimpin machine!
Maverick posted this at 19:36 — 25th April 2000.
They have: 334 posts
Joined: Dec 1999
Okay, the 1st thing to do is to try to isolate the problem. Try running the scripts through a DOS command line rather than through the browser. If they work okay that way, you know its a server configuration problem and is not related to your ActivePerl installation. If they don't run off the command line, recheck the shebang line again. If you're SURE that's okay and you're SURE the scripts themselves are okay, uninstall and reinstall ActivePerl.
If the scripts run okay via the DOS prompt, it's narrowed down to a server problem.
What web server software are you running the scripts through? It it properly configured to find Perl and to execute the scripts?
In Apache you need to edit the httpd.conf file so that it knows what to do with Perl scripts. In Xitami, it's the defaults.cfg file that needs to be edited to handle Perl. For other servers, you'll need to ask somebody else since I've never dealt with them.
Ken Elliott posted this at 20:03 — 26th April 2000.
They have: 358 posts
Joined: Jun 1999
Ok here is what I came up with. I checked httpd.conf and uncommented all of the CGI references, and made them available to be run from anywhere. But CGI scripts are still comming up as an unknown filetype and will not execute. They execute in DOS though, so it isn't PERL. Apache is the problem. Apache runs fine as I can tell. What could be the problem? If I have to add something to the .conf file please let me know, as I haven't found the answer in Apache or PERLs helpfiles. Thanx for the help.
VulKen
[This message has been edited by VulKen (edited 26 April 2000).]
Pimpin like a pimp with an electrofied pimpin machine!
Maverick posted this at 02:54 — 27th April 2000.
They have: 334 posts
Joined: Dec 1999
Grrrr, I hate it when a long reply gets lost when the server goes down. Okay, I'll try the Reader's Digest condensed reply version.
Check the following things in httpd.conf:
(this is a direct quote from the tutorial I used and it worked)
Open Apache's configuration file: c:\apache\conf\httpd.conf in a plain text editor. The following instructions are for Apache 1.3.6; line numbers may change with later versions.
1) At line 217, change:
ServerAdmin [email protected] to:
ServerAdmin webmaster@your_domain.com.
2) At line 232, uncomment (erase the # symbol), and change it to:
ServerName www.your_site.com.
3) At line 239, change:
DocumentRoot "C:/apache/htdocs" to:
DocumentRoot "C:/usr/etc/htdocs/your_site"
4) At line 264, change:
<Directory "c:/apache/htdocs"> to:
<Directory "c:/usr/etc/htdocs/your_site">
5) At line 303, you might want to change:
DirectoryIndex index.html to:
DirectoryIndex index.html index.htm index.cgi index.shtml
6) At line 458, change:
ScriptAlias /cgi-bin/ "c:/apache/cgi-bin/" to:
ScriptAlias /cgi-bin/ "c:/usr/etc/htdocs/your_site/cgi-bin/"
7) At lines 464, change: <Directory "c:/apache/cgi-bin"> to:
<Directory "c:/usr/etc/htdocs/your_site/cgi-bin">
8)Uncomment line 606 (erase the # symbol):
AddHandler cgi-script .cgi
That's it. Double-click on the apache.exe binary and a command prompt window should open up and stay up. (You may get a message saying something like [Sun Jul 04 15:50:18 1999] [warn] pid file c:/apache2/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?; this is a known annoyance and doesn't affect the running of Apache). Open your browser, write "localhost" in the GoTo window, cross your fingers, hit Return, and your homepage (the index.html page in whatever directory you assigned DocumentRoot to) should be displayed.
Here's a simple test: create the following Perl script:
#!/usr/bin/perl -w
print "Content-type: text/html\n\n";
print "This CGI script works!";
Save it as c:/usr/etc/htdocs/your_site/cgi-bin/test.pl. Now type localhost/cgi-bin/test.pl in your browser's GoTo window, hit Return, and you should see This CGI script works!.
Also, one other thing to check, in early version of Windows 95 you need to change the shebang line. In later version or Win98 ignore this:
!#/usr/local/bin/perl.exe
If none of that helps, the whole tutorial is at: http://www.visca.com/clueless/perl_apache_win9x.html
Ken Elliott posted this at 19:04 — 27th April 2000.
They have: 358 posts
Joined: Jun 1999
Ok I went through and uninstalled everything and reinstalled it to the "T". I have run into one area that may be the answer to my dilemma. It is within the httpd.conf file of apache and this is what it has commented, surely you have seen it.
# Action lets you define media types that will execute a script whenever
# a matching file is called. This eliminates the need for repeated URL
# pathnames for oft-used CGI file processors.
# Format: Action media/type /cgi-script/location
# Format: Action handler-name /cgi-script/location
I think that once I figure out how to do this, it should solve the problem. Because I have set apache up correctly, localhosts page pop up, error pages pop up, but when I go to access the cgi-bin it says that I don't have access. But if I try to access a file within the cgi-bin directory it says that the file cannot be found...but of course it is there. Maybe it is a chmod issue or something..I am still dabbling, but if you know the answer to this one it should finish of my problem.
Thanks for you accurate help Maverick!
VulKen
Pimpin like a pimp with an electrofied pimpin machine!
Ken Elliott posted this at 19:30 — 27th April 2000.
They have: 358 posts
Joined: Jun 1999
Don't know what I did, but now .cgi and .pl are working just great...I couldn't be happier!!!!!! You da'man Maverick...show em sum luv.
VulKen
Maverick posted this at 20:22 — 27th April 2000.
They have: 334 posts
Joined: Dec 1999
That's the nice thing about Apache. Since so many people use it, you're bound to stumble across someone who managed to stumble across the site that had the right answers.
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.