LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Closed Thread
 
Search this Thread
Old 12-14-2004, 01:32 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
Running web based perl scripts 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
 
Old 12-15-2004, 06:51 AM   #2
peter_robb
Senior Member
 
Registered: Feb 2002
Location: Szczecin, Poland
Distribution: Gentoo, Debian
Posts: 2,458

Rep: Reputation: 47
Please do not post the same thread in more than one forum. Picking the most relevant forum and posting it once there makes it easier for other members to help you and keeps the discussion all in one place.

http://www.linuxquestions.org/rules.php

Original thread is http://www.linuxquestions.org/questi...hreadid=266351
 
  


Closed Thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
problems in running cgi/perl scripts... raymond Linux - General 17 02-09-2010 04:06 AM
running perl scripts very system start abdul_zu Programming 16 09-26-2005 01:55 AM
Running perl scripts outside of cgi-bin ylikone Programming 1 09-08-2005 04:34 AM
Executing web based Perl programs in userdirs markham82 Linux - General 3 12-15-2004 07:49 PM
Running Perl/CGI scripts hso_sof Linux - Newbie 3 08-22-2003 10:26 AM


All times are GMT -5. The time now is 07:24 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration