Perl 5.8.0 / Sendmail

colinr

Registered
Hi,

I want to try and learn something about Perl but can't seem to get it running on my Mac (OS 10.2). Its the installation that the machine came with if that makes a difference.

I installed the 5.8.0 package from www.serverlogistics.com but when I try a perl file (eg. http://localhost/test/formmail.pl - test is an alias for /Library/WebServer/test/ set up in httpd.conf) it just shows me the file contents - doesn't parse it.

I tried uncommenting the lines for mod_perl in httpd.conf but that didn't seem to help.

Also... I want to be able to use sendmail from PHP. I did a test and the logfile reported it as failing because it wont authorise localhost. How do I make it let me use it?

I read something about chmod g-w / but not sure what g-w means and it said something about this disallowing finder access to things.

Thanks!

--
Colin
 
you need to setup your test directory so that apache will parse perl scripts as perl scripts and not html files. there are two ways to do this:


ScriptAlias /test/ "/Library/Webserver/test/"


or


<Directory "/Library/Webserver/test">
Options ExecCGI
</Directory>


you will also need this line:

AddHandler cgi-script .cgi .pl
 
Thanks for the reply.

I tried it and it now recognises the .pl extension but says I don't have permission.

However, I have also decided I don't want to learn perl anyway :)

Thankyou
-Colin
 
oh come on...perl's great. i definitely prefer PHP for web development, but for any and all sysadmin/file system needs, Perl is where it's at! as far as your permission issue is concerned, the fix is a simple one. apache executes Perl scripts with the same UID that runs the daemon (most likely nobody, www or apache). so if the server runs as User apache and Group apache, you need to run these commands:

chown yourusername:apache script.pl
chmod 750 script.pl

or if you don't want to change the ownership of the files, then run this command:

chmod 755 script.pl

i use the first scheme as it greatly reduces who has access to the script.
 
...but I don't have any sysadmin / filesystem needs :)

Anyhow, I tried again to get it running out of curiosity, and here is my transcript:

[colin:~] colinrichardson% cd /Library/WebServer/devsites/niag/cgi-bin
[colin:devsites/niag/cgi-bin] colinrichardson% chown colinrichardson:apache formmail.pl
chown: apache: invalid group name

So I tried the other way:

[colin:devsites/niag/cgi-bin] colinrichardson% chmod 755 formmail.pl
[colin:devsites/niag/cgi-bin] colinrichardson% ls -l
total 64
-rwxr-xr-x 1 colinric admin 29154 Oct 30 17:11 formmail.pl

Still my 403 error, no permission for me.

Perhaps I didn't set up httpd.conf properly somewhere? Beyond Aliasing folders I don't really understand what I'm doing with it see.

-Colin
 
apparently, you don't have an apache group on your system. what i showed you was only an example. you need to change the group ownership of your script to whatever group your apache server runs as... run this command:

less path/to/httpd.conf | grep Group

you should see one line that looks similar to this:

Group <somename>

whatever name is listed on the Group line is the name you want to use. don't forget to run the chmod command so the group will have execute permissions.

EDIT: i guess i should have told you that the apache daemon group also needs permission to decend into the cgi-bin directory:

chown yourusername:servergroupname cgi-bin
chmod 750 cgi-bin

or simply

chmod 755 cgi-bin
 
My group turned out to be "www".

I chown'd and chmod'd but it still doesn't want to know :)

I think, as someone pointed out, I really don't have a clue what I'm doing here. Think I will leave it for now before I start tearing hair out.

What I really need is a nice package where I can install something and copy/paste stuff into the terminal to make it all work, just like how I got PHP running. Server admin isn't really where I want to be heading.

Thanks for your help though!

-Colin
 
Back
Top