Perl Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPerl Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old July 12th, 2001, 09:23 AM
Folkert Folkert is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2001
Posts: 0 Folkert User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
ActivePerl on win 98 with Apache server

Hello there,

On my local pc i got the apache server, and php 4 and Mysql running. This all works great. But now i installed active Perl and i want to execute perl form the apache server. I allready looked in the config files, but with my little knowledge i just can't get my cgi-bin to run .pl and .cgi files.
Does anyone have an idea how and why etc etc

Greetz from Holland

Folkert

Reply With Quote
  #2  
Old July 12th, 2001, 10:06 AM
footinmouth footinmouth is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2001
Location: North Vancouver, BC, Canada
Posts: 44 footinmouth User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Error.log is a good place to start

Try calling " printenv.pl " from your browser.
I am quite sure this file is installed in the cgi-bin dir
with apache as a test file.

i.e. http://127.0.0.1/cgi-bin/printenv.pl

Then look in the error.log file for apache if it does not work.


Also is the first line of printenv.pl like :

#!/usr/bin/perl

yeilds "couldn't spawn child process:" in error.log
as apache is trying to find perl in the wrong place

on my win 98 it is :

#!c:/perl/bin/perl


Hope this helps .

incase printenv.pl is not there:

Code:
#!c:/perl/bin/perl
##
##  printenv -- demo CGI program which just prints its environment
##

print "Content-type: text/html\n\n";


foreach $var (sort(keys(%ENV))) {
    $val = $ENV{$var};
    $val =~ s|\n|\\n|g;
    $val =~ s|"|\\"|g;
    print "${var}=\"${val}\"<br>\n";
}
__________________
Thanks

Foot in Mouth ver 1.2.5 Onion

Reply With Quote
  #3  
Old July 12th, 2001, 10:14 AM
Folkert Folkert is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2001
Posts: 0 Folkert User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanx for your quick answer
I did al the test thing with de sample file printenv.pl.
What i didn't do was viewing the error log. That's wath i'm gonna do next.
Thanx and i hope the answer is in the error log Otherwise I'llbe back.

Folkert

Reply With Quote
  #4  
Old July 12th, 2001, 10:46 AM
Folkert Folkert is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2001
Posts: 0 Folkert User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
The error.log says the same as the browser and that is file not found. It's there allready do. I think i need to look in the conf files ? perhaps from apache. Then maybe i can tell appache that perl is there ? In dos command perl -v it's there
This is the first time for me with this, so the config file look al little difficult

Folkert

Reply With Quote
  #5  
Old July 12th, 2001, 10:47 AM
footinmouth footinmouth is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2001
Location: North Vancouver, BC, Canada
Posts: 44 footinmouth User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
warning's flag helps also

Add also the warning's switch


#!c:/perl/bin/perl -w

Helps track down all sorts of fun errors.

Look in the error.log to see the warning's.

Reply With Quote
  #6  
Old July 12th, 2001, 11:00 AM
footinmouth footinmouth is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2001
Location: North Vancouver, BC, Canada
Posts: 44 footinmouth User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Next look in httpd.conf

Open httpd.conf in a text editor.

Look for and correct to your situation:

1. BindAddress * [ leave if on dhcp ]

2. ServerName www.yourSite.com [ OR 127.0.0.1 ]

3. ScriptAlias /cgi-bin/ "C:/Program Files/Apache Group/Apache/cgi-bin/"

4. DocumentRoot "C:/Program Files/Apache Group/Apache/htdocs"


Restart apache if changes are made to httpd.conf file.

Reply With Quote
  #7  
Old July 12th, 2001, 11:32 AM
dsb dsb is offline
PerlGuy
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jan 2001
Posts: 714 dsb User rank is Sergeant Major (2000 - 5000 Reputation Level)dsb User rank is Sergeant Major (2000 - 5000 Reputation Level)dsb User rank is Sergeant Major (2000 - 5000 Reputation Level)dsb User rank is Sergeant Major (2000 - 5000 Reputation Level)dsb User rank is Sergeant Major (2000 - 5000 Reputation Level)dsb User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 2 Days 15 h 44 m 20 sec
Reputation Power: 36
Send a message via AIM to dsb
You also have to help Apache recognize the .pl or .cgi extensions.

Open httpd.conf and make sure the following is in there:
Code:
    #
    # AddHandler allows you to map certain file extensions to "handlers",
    # actions unrelated to filetype. These can be either built into the server
    # or added with the Action command (see below)
    #
    # If you want to use server side includes, or CGI outside
    # ScriptAliased directories, uncomment the following lines.
    #
    # To use CGI scripts:
    #
    AddHandler cgi-script .cgi
    AddHandler cgi-script .pl


The important part being the 'AddHandler' lines.
__________________
- dsb -
Perl Guy

Reply With Quote
  #8  
Old July 12th, 2001, 11:52 AM
Folkert Folkert is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2001
Posts: 0 Folkert User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Woh you are great.

Okee footinmouth :) coming closer :) first the file was not found at all. Now the file gives a 500 error and a warning:

A required .DLL file, PERLCRT.DLL, was not found

I put this in de config:

ScriptAlias /cgi-bin/ "C:/phpdev3/apache/cgi-bin/"

#!c:/perl/bin (this is the map for perl.exe) Maybe it's this call ?


ServerName 212.204.172.31 and tryed ServerName localhost


Now i go view the error log again :)
And i go check for the input from the last reply of dsb

Thanx in advance

[edit]
Just found this in the error.log :
[Thu Jul 12 18:44:25 2001] [error] [client 127.0.0.1] couldn't spawn child process: c:/phpdev3/apache/cgi-bin/printenv.pl
[/edit]
Folkert

Reply With Quote
  #9  
Old July 12th, 2001, 12:24 PM
DJdrenaline DJdrenaline is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jun 2001
Location: Toronto, Ontario, Canada
Posts: 631 DJdrenaline User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 m 4 sec
Reputation Power: 8
I don't know perl and haven't read any of the replies... but I read somewhere that with windows, you have to name your files with .bat not .pl

This probably won't help....

Reply With Quote
  #10  
Old July 12th, 2001, 12:53 PM
dsb dsb is offline
PerlGuy
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jan 2001
Posts: 714 dsb User rank is Sergeant Major (2000 - 5000 Reputation Level)dsb User rank is Sergeant Major (2000 - 5000 Reputation Level)dsb User rank is Sergeant Major (2000 - 5000 Reputation Level)dsb User rank is Sergeant Major (2000 - 5000 Reputation Level)dsb User rank is Sergeant Major (2000 - 5000 Reputation Level)dsb User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 2 Days 15 h 44 m 20 sec
Reputation Power: 36
Send a message via AIM to dsb
DJdrenaline,
I've got Win98 and Win2K running Apache with PerlCGI and PHP4 and that is not the case. Just an FYI.

Reply With Quote
  #11  
Old July 12th, 2001, 04:07 PM
DJdrenaline DJdrenaline is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jun 2001
Location: Toronto, Ontario, Canada
Posts: 631 DJdrenaline User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 m 4 sec
Reputation Power: 8
That's what I thought, sorry I couldn't help

Reply With Quote
  #12  
Old July 12th, 2001, 04:22 PM
Folkert Folkert is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2001
Posts: 0 Folkert User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Still the same, only 500 errors and in the error still the message (in the topic )

Folkert

Reply With Quote
  #13  
Old July 12th, 2001, 05:52 PM
footinmouth footinmouth is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2001
Location: North Vancouver, BC, Canada
Posts: 44 footinmouth User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Out for a while

So you are getting a 500 error.

Try in a dos window, in the cgi-bin :

perl -c printenv.pl

which should just test compile the printenv.pl and
display any obvious errors. Such as perl not found or
a simple error in the perl file.


I will put my thinking cap on soon so keep up the work.

Reply With Quote
  #14  
Old July 12th, 2001, 05:59 PM
Folkert Folkert is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2001
Posts: 0 Folkert User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Allrigth now The printenv.pl runs and gives me back the vars from the server like server host etc

It is working there.
Now i reached (thanx a lot to you guys) a second level. How to instal flock() ?

Folkert

Reply With Quote
  #15  
Old July 12th, 2001, 06:26 PM
footinmouth footinmouth is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2001
Location: North Vancouver, BC, Canada
Posts: 44 footinmouth User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Generally use ppm

Active State perl uses the perl package manager [ ppm ]
to install or upgrade packages with ease.
You can get packages and compile on your machine also.
See ActiveState web site for "Perl Modules" [ top right area].
See ActiveState also for ppm "Help"

ppm example in DOS window:
Code:
C:\Perl\bin>ppm help
Commands:
    exit              - leave the program.
    help [command]    - prints this screen, or help on 'command'.
    install PACKAGES  - installs specified PACKAGES.
    quit              - leave the program.
    query [options]   - query information about installed packages.
    remove PACKAGES   - removes the specified PACKAGES from the system.
    search [options]  - search information about available packages.
    set [options]     - set/display current options.
    verify [options]  - verifies current install is up to date.
    version           - displays PPM version number

C:\Perl\bin>ppm search flock
Packages available from http://ppm.ActiveState.com/cgibin/P...server.pl?urn:/
PPMServer:
File-FlockDir [1.02] override perl flock() for network or portability purposes


You may not need this package depending on your required results.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > ActivePerl on win 98 with Apache server


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off