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


Closed Thread
  Search this Thread
Old 12-14-2004, 01:32 PM   #1
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 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 I've been testing this with (see below). When I run it from the server root cgi-bin directory, e.g.,, 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:

[Tue Dec 14 11:50:54 2004] [error] [client] Premature end of script headers:
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:

<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


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

        SetHandler cgi-script


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

        AllowOverride None
        Allow from from all

        Order allow,deny

This is the test perl program i'm trying to run:

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: works, 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!

Old 12-15-2004, 06:51 AM   #2
Senior Member
Registered: Feb 2002
Location: Szczecin, Poland
Distribution: Gentoo, Debian
Posts: 2,458

Rep: Reputation: 48
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.

Original thread is

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 > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 11:03 PM.

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