LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-14-2004, 12:51 PM   #1
markham82
LQ Newbie
 
Registered: Oct 2004
Location: Rochester, NY, USA
Distribution: Red Hat 7, 9, Fedora Core 2, Windows 2000/XP
Posts: 27

Rep: Reputation: 15
Executing web based Perl programs in userdirs


I'm running an apache web server (version 2.0.49) on a Fedore Core 2 machine. I'm have a few users using it with a UserDir on (e.g. I can do http://www.example.com/~user). I want to enable perl execution in the user's www directory. In each user's www directory is a cgi-bin directory. So I want users to run perl programs, like http://www.example.com/~user/cgi-bin/test.pl. I've been testing this with test.pl (see below). When I run it from the server root cgi-bin directory, e.g., http://www.example.com/cgi-bin/test.pl, it works totally fine. But when I test it in a user's directory, it fails. The error I get in the apache log is:

Code:
[Tue Dec 14 11:50:54 2004] [error] [client 192.168.1.104] Premature end of script headers: test.pl
I don't understand why it works under the document root and not under the user directories. Here is a portion of my httpd.conf file that I thought I configured correctly:

Code:
<IfModule mod_userdir.c>
    #
    # UserDir is disabled by default since it can confirm the presence
    # of a username on the system (depending on home directory
    # permissions).
    #
    #UserDir "disable"

    #
    # To enable requests to /~user/ to serve the user's public_html
    # directory, use this directive instead of "UserDir disable":
    #
    UserDir www
</IfModule>

...

<Directory "/home/users/*/www/cgi-bin">
        Options ExecCGI

        SetHandler cgi-script

</Directory>

<Directory "/path/to/doc/root/testuser/www/cgi-bin">
        Options ExecCGI

        AllowOverride None
        Allow from from all

        Order allow,deny

</Directory>
This is the test perl program i'm trying to run:

Code:
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "Hello, World.";
Right now the home directories are in a place that is not under the document root. I tried creating a test user who's home directory was in fact under the document root, and created a www and a cgi-bin folder inside that. When I go to it on the web without UserDir it works, with UserDir, it doesn't. In other words:

http://www.example.com/testuser/www/cgi-bin/test.pl works,

http://www.example.com/~testuser/cgi-bin/test.pl does NOT work.

Permissions are all fine, the appropriate user owns all the directories involved. And the same perl program can be executed on the command line. Apache is being run as user: apache, group: apache.

Anyone have any ideas why this is happening and how it can be fixed? I would appreciate any help on this, thanks!

~Steve

Last edited by markham82; 12-14-2004 at 12:53 PM.
 
Old 12-15-2004, 07:36 AM   #2
Butt-Ugly
Member
 
Registered: Nov 2004
Location: Brisbane, Australia
Distribution: Fedora Core 5
Posts: 89

Rep: Reputation: 15
You've set the cgi-script handler for the users cgi, but you haven't added it in the config.

Code:
AddHandler cgi-script .cgi .pl
I am currently writing this chapter at the moment: http://www.brennan.id.au/13-Apache_Web_Server.html

Good luck..

Miles.
 
Old 12-15-2004, 07:41 AM   #3
markham82
LQ Newbie
 
Registered: Oct 2004
Location: Rochester, NY, USA
Distribution: Red Hat 7, 9, Fedora Core 2, Windows 2000/XP
Posts: 27

Original Poster
Rep: Reputation: 15
Still doesnt work
 
Old 12-15-2004, 07:49 PM   #4
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
Did you remember to re-start the Web server after modifyingthe config file?
 
  


Reply



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

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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Running web based perl scripts in userdirs markham82 Linux - Networking 1 12-15-2004 06:51 AM
[JAVA - JLabel] executing a method based on contents of the variable linux_ub Programming 1 08-12-2004 09:50 AM
Free web based control panel for web hosting? mooman_fl Linux - Software 0 06-18-2004 05:16 PM
from a gui-based s/w to a web-based app h/w Programming 0 04-13-2004 02:07 PM
Executing Perl Programs 1huskerfan Programming 3 01-06-2002 07:39 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:22 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration