| View previous topic :: View next topic |
| Author |
Message |
fd1000
Joined: 17 Nov 2005 Posts: 9
|
Posted: Thu 17 Nov '05 10:05 Post subject: Getting Perl Working |
|
|
Hello All!
I have decided to ditch Apache and use Sambar.
And so far Sambar has been much easier to use then Apache.
However I cannot get my perl scripts to work.
I turned on error reporting for CGI scripts.
When trying to run one of my scripts, I get the following error shown in the browser window:
Can't locate CGI.pm in @INC (@INC contains: .) at C:\sambar62\cgi-bin\myscript.pl line 5. BEGIN failed--compilation aborted at C:\sambar62\cgi-bin\myscript.pl line 5.
Line 5 of my perl script is where is say to 'Use CGI;'
Apparently Sambar cannot find the perl modules required to run my script.
The sample perl scripts shipped with Sambar work fine.
ActiveState Perl is installed, and works fine when I use Apache. Also, all of my scripts work fine under Apache.
So HOW do I get Sambar to find these perl modules, or how do I get past this???
Thank you in advance. |
|
| Back to top |
|
Steffen
Joined: 07 Jun 2004 Posts: 403 Location: Netherlands
|
Posted: Thu 17 Nov '05 12:03 Post subject: |
|
|
Be sure that in config.ini "CGI Extensions = *.pl" and "Perl Executable =" (empty).
Steffen |
|
| Back to top |
|
fd1000
Joined: 17 Nov 2005 Posts: 9
|
Posted: Thu 17 Nov '05 19:22 Post subject: |
|
|
Thank you for the reply.
I made those changes, but I am still getting the same error.
Can't locate CGI.pm in @INC (@INC contains: .) at C:\sambar62\cgi-bin\myscript.pl line 5. BEGIN failed--compilation aborted at C:\sambar62\cgi-bin\myscript.pl line 5.
I guess I am really suprised at how little information there is both on the web and in this forum about this problem.
I have the most basic installation of Sambar, and I have the most basic installation of ActivateState Perl.
Simple perl scripts DO work.
Any script trying to use CGI.pm or any other type of module fails.
I would think that this would be a common problem, since anyone installing Sambar and ActiveState Perl would wind up with the same install I have.
I'm just a normal programmer trying to setup Sambar to work with Perl, and I am stopped cold right now.
Help!
P.S.-I REALLY like Sambar, I don't want to ditch it just because of this. |
|
| Back to top |
|
Steffen
Joined: 07 Jun 2004 Posts: 403 Location: Netherlands
|
Posted: Thu 17 Nov '05 19:32 Post subject: |
|
|
No clue what the cause of your problem is. First time I heard of this problem. And most of us are running Activestate perl by installing the .msi package.
Pity you do not get it running. |
|
| Back to top |
|
fd1000
Joined: 17 Nov 2005 Posts: 9
|
Posted: Thu 17 Nov '05 23:30 Post subject: |
|
|
Come on guys!
I have ANOTHER brand-new server that I am also suppose to use Sambar on.
This is ALL I have done:
- Brand-New Windows 2000 Professional Server with nothing on it
- Installed ActiveState Perl.
- Installed Sambar.
- Turned on CGI error reporting in Sambar.
- Placed the following PERL script into the cgi-bin folder:
#!/usr/bin/perl
use CGI;
print "Hello World\n";
And I get the same error as before, Can't locate CGI.pm.
The version of Perl that is installed is the latest, downloaded directly from ActiveState.
At this point, anyone could replicate this problem. Just install Perl, install Sambar, and try running a perl script that uses CGI.pm, it will FAIL.
NO ONE HAS EVER HAD THIS PROBLEM???
How can I replicate this on THREE machines, if no one has had this problem?
Is this one of those totally stupid DUH questions, and somehow I am missing something totally simple?
HELP!!!!!!!!!!!
TY. |
|
| Back to top |
|
Steffen
Joined: 07 Jun 2004 Posts: 403 Location: Netherlands
|
Posted: Fri 18 Nov '05 0:00 Post subject: |
|
|
No, never seen this perl issue reported. And believe me, lots and lots using Activestate Perl with Sambar.
Resume:
Install the .msi from activistate
Check the Sheban line points to your perl.exe.
eg. #!c:/perl/bin/perl.exe
In config.ini, try:
CGI Extensions = *.pl
Perl Executable = (leave empty)
WinCGI Extensions =
CGI Run As =
CGI Directory =
WinCGI Directory =
Remove in mappings.ini any perl stuff, if it is there.
Btw. which version of Sambar are you running ?
Steffen |
|
| Back to top |
|
fd1000
Joined: 17 Nov 2005 Posts: 9
|
Posted: Fri 18 Nov '05 1:24 Post subject: |
|
|
Hello.
I am using Sambar version 6.2.
I tried the settings that you recommended, and actually nothing worked after that.
I don't know how Sambar will know where the cgi-bin folder is if it is removed from the config.ini file.
Could somone please post their config.ini file, one that works with CGI.pm in perl?
I have sambar and active state installed in the following folders:
C:\sambar62
C:\perl
Can you successfully run a script that has 'use CGI' in it? |
|
| Back to top |
|
fd1000
Joined: 17 Nov 2005 Posts: 9
|
Posted: Fri 18 Nov '05 6:34 Post subject: |
|
|
ANSWER:
After installing ActiveState Perl and Sambar 6.2, to get perl working correctly, you must modify the mappings.ini file.
Under the [CGI] section of the mappings.ini file, you must have the following, AND ONLY THE FOLLOWING:
[CGI]
*.pl = c:/perl/bin/perl.exe
You cannot have more then one listing for *.pl.
So, if you want to use ActiveState Perl, and you want it to work correctly, you must modify the mappings.ini file to have all *.pl files executed by the correct executable.
P.S.-Changing the Perl Executable switch in the config.ini file didn't seem to do anything. |
|
| Back to top |
|
Steffen
Joined: 07 Jun 2004 Posts: 403 Location: Netherlands
|
Posted: Fri 18 Nov '05 12:42 Post subject: |
|
|
The setting in mappings.ini is just that you do not need a Shebang line in your script. So not a must.
I have nothing perl related in mappings.in.
Try to run the test-tool www.sambarserver.info/download/perldiver.zip maybe you find a clue.
Steffen |
|
| Back to top |
|
cryptor3

Joined: 13 Jun 2004 Posts: 101 Location: kah-li-forn-yah
|
Posted: Fri 25 Nov '05 19:43 Post subject: |
|
|
I agree with steffen, you shouldn't have to do anything with mappings.ini. I also have nothing in my mappings.ini file.
I don't know what the shebang line was in your myscript.pl, but most likely it shouldn't be #!/usr/bin/perl. It should probably be #!c:/perl/bin/perl or #!/perl/bin/perl, since there is probably no usr/bin folder on your computer.
But if you've found something that works, I guess you should just go with it.
If you still want us to sort out why your setup wasn't working, perhaps you could post the beginning of the sample myscript.pl script that you're using, if it's not too long. Also indicate the combination of CGI Extensions/Perl executable that you were using that didn't work. |
|
| Back to top |
|