Advice for enabling perl on OSX

2004-04-22 Thread Eric Curts
Greetings!

I while back I wrote about assisting a neighboring school district with some
perl scripts I had written to allow teachers to easily make web pages.
Thanks very much to everyone who gave such good advice.  That really helped.

Now we are actually in the process of getting the scripts to work for them
and have hit an early problem...

I loaded a simple script to just test things out (one that just prints out
environment variables) and it will not run.  When I try to bring up the
script I get:

Forbidden
You don't have permission to access /hck/cgi-bin/printev.cgi on this server.





Apache/1.3.26 Server at eagle Port 16080


I set the permissions to 755 for the script, and the folder is web
accessible because html files open up fine from that location.  When I make
a terminal connection and try to run the script from the command line, it
will not work either.

I think it may be a more fundamental problem, such as needing to edit
something in their httpd.conf file or needing to enable something else on
the server so that perl scripts will be executed.  They have never runs
scripts before, so nothing has every been set up for this.

I would appreciate any suggestions you have for this problem, especially an
idea of what configurations are needed the first time to get an OSX server
to execute perl scripts.

As always, thanks so much!

Eric

* Eric Curts
* Technology Specialist, North Canton City Schools
* [EMAIL PROTECTED]
* (330) 497-5600 x377
* FAX (330) 497-5618
*
* Give a man a fish and you feed him for a day;
* teach him to use the Net and he won't bother you for weeks.



Re: Advice for enabling perl on OSX

2004-04-22 Thread Chris Devers
On Thu, 22 Apr 2004, Eric Curts wrote:

 I loaded a simple script to just test things out (one that just prints
 out environment variables) and it will not run.  When I try to bring
 up the script I get:

 Forbidden
 You don't have permission to access /hck/cgi-bin/printev.cgi on this server.

This usually means one of two things:

  * the script itself isn't executable, or

  * Apache isn't configured to be able to execute
scripts from this directory.

In the former case, the fix is to go into the command line and use
`chmod` to make sure that execution rights are turned on. Try this:

chmod 0755 /path/to/hck/cgi-bin/printenv.cgi

But as you say, you tried that.

In the latter case, Apache needs to be set up to launch scripts. There
are two ways to do this, with different schools of thoughts as to which
is better:

  * tell Apache to execute all files under a certain directory, or

  * tell Apache to execute all files with a certain extension

For the first approach, the copy of Apache that came with your Mac
should already include a section in /etc/http/httpd.conf that sets up
the file path /Library/WebServer/Documents/CGI-Executables as your web
accessible /cgi-bin/ directory. Basically, you hav these directives:

ScriptAlias /cgi-bin/ /Library/WebServer/CGI-Executables/
Directory /Library/WebServer/CGI-Executables
AllowOverride None
Options None
Order allow,deny
Allow from all
/Directory

Cloning those settings for your directories should work.

For the latter approach, look for a commented out line like this:

#AddHandler cgi-script .cgi

You can uncomment it, and add other extensions, to get something like:

AddHandler cgi-script .cgi .pl .py .rb

This will allow files with extensions identifying themselves as generic
CGI scripts, Perl scripts, Python, or Ruby. You get the idea.


Try making one or both of those Apache changes in /etc/httpd/httpd.conf,
then run `apachectl configtest  apachectl restart` to load the
changes. If that still doesn't work, make sure that the CGI module is
being loaded into Apache at launch time by making sure that this line --

LoadModule cgi_module libexec/httpd/mod_cgi.so

-- is uncommented. It should be, but make sure.

If you still have problems, look for the relevant part of your error log
file in /var/log/httpd/error_log, and send what you find to the list.



-- 
Chris Devers


Re: Advice for enabling perl on OSX

2004-04-22 Thread Morbus Iff
Try making one or both of those Apache changes in /etc/httpd/httpd.conf,
then run `apachectl configtest  apachectl restart` to load the
changes. If that still doesn't work, make sure that the CGI module is
being loaded into Apache at launch time by making sure that this line --
Minor correction - he'll need to use sudo
before each of the apachectl commands.
--
Morbus Iff ( i put the demon back in codemonkey )
Culture: http://www.disobey.com/ and http://www.gamegrene.com/
Spidering Hacks: http://amazon.com/exec/obidos/ASIN/0596005776/disobeycom
icq: 2927491 / aim: akaMorbus / yahoo: morbus_iff / jabber.org: morbus


Re: Advice for enabling perl on OSX

2004-04-22 Thread Chris Devers
On Thu, 22 Apr 2004, Morbus Iff wrote:

  Try making one or both of those Apache changes in /etc/httpd/httpd.conf,
  then run `apachectl configtest  apachectl restart` to load the
  changes. If that still doesn't work, make sure that the CGI module is
  being loaded into Apache at launch time by making sure that this line --

 Minor correction - he'll need to use sudo
 before each of the apachectl commands.


Ahh, right, of course.

On the other hand, the Apache error page mentioned that it was running
on a non-standard port (16nnn), so I'm assuming that Eric knows how to
test  restart his Apache instance.

But yes, use sudo for `apachectl` commands.


-- 
Chris Devers


Re: Advice for enabling perl on OSX

2004-04-22 Thread Dave Gomez
The one I caught was that you couldn't run it from the command line  
with proper permissions.  Do a whereis perl to ensure it's there, a  
perl -v to check it's info, and verify that you can run the script from  
the commandline.

dave

On Apr 22, 2004, at 6:59 AM, Eric Curts wrote:

Greetings!

I while back I wrote about assisting a neighboring school district  
with some
perl scripts I had written to allow teachers to easily make web pages.
Thanks very much to everyone who gave such good advice.  That really  
helped.

Now we are actually in the process of getting the scripts to work for  
them
and have hit an early problem...

I loaded a simple script to just test things out (one that just prints  
out
environment variables) and it will not run.  When I try to bring up the
script I get:

Forbidden
You don't have permission to access /hck/cgi-bin/printev.cgi on this  
server.

--- 
-


Apache/1.3.26 Server at eagle Port 16080

I set the permissions to 755 for the script, and the folder is web
accessible because html files open up fine from that location.  When I  
make
a terminal connection and try to run the script from the command line,  
it
will not work either.

I think it may be a more fundamental problem, such as needing to edit
something in their httpd.conf file or needing to enable something else  
on
the server so that perl scripts will be executed.  They have never runs
scripts before, so nothing has every been set up for this.

I would appreciate any suggestions you have for this problem,  
especially an
idea of what configurations are needed the first time to get an OSX  
server
to execute perl scripts.

As always, thanks so much!

Eric

* Eric Curts
* Technology Specialist, North Canton City Schools
* [EMAIL PROTECTED]
* (330) 497-5600 x377
* FAX (330) 497-5618
*
* Give a man a fish and you feed him for a day;
* teach him to use the Net and he won't bother you for weeks.




Re: Advice for enabling perl on OSX

2004-04-22 Thread Jeff Lowrey
At 11:00 AM 4/22/2004, Chris Devers wrote:
On the other hand, the Apache error page mentioned that it was running
on a non-standard port (16nnn), so I'm assuming that Eric knows how to
test  restart his Apache instance.
Not necessarily.

Enabling Performance monitoring or something like that in the 
configuration tool for OS X Server will cause web sites to move to port 16080.

But the config tool also lets you restart the Apache instance.

-Jeff Lowrey





Re: Advice for enabling perl on OSX

2004-04-22 Thread Joel Rees
On 2004.4.22, at 10:59 PM, Eric Curts wrote:

...
I loaded a simple script to just test things out (one that just prints  
out
environment variables) and it will not run.  When I try to bring up the
script I get:
What command line are you using?

Forbidden
You don't have permission to access /hck/cgi-bin/printev.cgi on this  
server.
What permissions do you have on the directory /hck/cgi-bin, the  
directory /hck, and the root directory?

Also, who owns (user and group) the file and each parent directory  
going up?

Since the message is about access, I would expect the problems to be  
something in permissions and user/group. However, I'll add the  
following comments to what the others have said:



--- 
-


Apache/1.3.26 Server at eagle Port 16080

I set the permissions to 755 for the script,
I prefer to use 750, making sure the script is owned by the www group,  
myself. But the looser permissions should give you access, if the  
elements of the path up the line are accessible.

and the folder is web
accessible because html files open up fine from that location.
As has been pointed out, script and hypertext access are set set  
separately. Since you call the directory /hck/cgi-something, I assume  
this directory is for scripts, and you are keeping the scripts and html  
separate. That's good.

But in that case you wouldn't want html files in that directory  
accessible to the web.

 When I make
a terminal connection and try to run the script from the command line,  
it
will not work either.
What's the system's complaint?

I think it may be a more fundamental problem, such as needing to edit
something in their httpd.conf file or needing to enable something else  
on
the server so that perl scripts will be executed.  They have never runs
scripts before, so nothing has every been set up for this.
My memory is that ... . Wait, I have the client version, not the server  
version, so I couldn't say for sure whether the primary script  
directory is enabled in httpd.conf in your case. In any case,  
/hck/cgi-bin is most likely not enabled for scripts. As mentioned, you  
need a section in httpd.conf that looks something like

ScriptAlias /cgi-bin/ /hck/cgi-bin/

Directory /hck/cgi-bin
AllowOverride None
Options None
Order allow,deny
Allow from all
/Directory
to allow access from the web. You'll also may need to set up httpd.conf  
to allow access from the high port. I think a listen line may be  
enough to get you started, although you may have to do more than that  
before you go to production.

I would appreciate any suggestions you have for this problem,  
especially an
idea of what configurations are needed the first time to get an OSX  
server
to execute perl scripts.
Well, read the comments in httpd.conf carefully. We only have vague  
guesses, since we don't know your setup. In case you aren't aware,  
Apple leaves the on-line manual accessible where the apache foundation  
folks were thoughtful enough to put it, at

http://localhost/manual/

Joel Rees