Solved

Creating a CGI directory for each User ---problem (Not working ..i just get to see the source code)

Posted on 2004-08-04
10
256 Views
Last Modified: 2010-03-04
Hello ..I am trying out somethings on my laptop (learning ...).I was able to configure the httpd server for CGI etc ...

Now I want to do the same for the "user" on my laptop.

I am unable to do so ...please help me on this

This is what I did...
******************************************************************************************************
1. Configured the server to take html files such that the user can access his html files by  "http://localhost/~bob/"

I did this  by  
a) Uncommenting the UserDir
b) Adding this
<Directory /home/*/html>
    AllowOverride FileInfo AuthConfig Limit
    Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
    <Limit GET POST OPTIONS>
        Order allow,deny
        Allow from all
    </Limit>
    <LimitExcept GET POST OPTIONS>
        Order deny,allow
        Deny from all
    </LimitExcept>
</Directory>

This worked good

2.Next I tried to add CGI previlages to the user
I did the following ( I got this from the net)

<Directory /home/*/html/cgi-bin/>
    Options ExecCGI
    SetHandler cgi-script
</Directory>

*********************************************************************************************************
This does not work what I see is the source code that is in the sample cgi file.

Am I doing something wrong
0
Comment
Question by:micro_learner
10 Comments
 
LVL 4

Expert Comment

by:TomDavidson
ID: 11716999
Do cgi applications work on the main location (without the /~user/)?
0
 

Author Comment

by:micro_learner
ID: 11718262
The CGI works for the main location ....

http://localhost/cgi-bin/test.cgi  works


Normal HTML files work for the user

http://localhost/~user/test.html   works


CGI for the User show the source code in the browser

http://localhost/~user/cgi-bin/test.cgi  shows the source code
0
 
LVL 4

Accepted Solution

by:
TomDavidson earned 168 total points
ID: 11720562
Try:
AddHandler cgi-script cgi pl
instead of:
SetHandler cgi-script
in the <Directory> block
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

Author Comment

by:micro_learner
ID: 11722104
I am sorry but ..the problem has changed track..I mean I get a different error now.(even before i did the above..not sure why .)

It says :Premature end of Script headers:test.cgi
Error 500

I thought it could be a script problem but this does not work for even html files!
The html file that works for say http://localhost/~bob/test     
does not work  for http://localhost/~bob/cgi-bin/test   gives the same error 500

These are the permissions I currently have

/home drwxr-wr-w
/home/bob   drwxr-wr-w
/home/bob/html drwxrwxr-x
/home/bob/html/cgi-bin  drwxr-xr-x

all the files in the cgi-bin are rwxr-xr-x

P.S : This may not be a problem with the script as I am using the same script that works for http://localhost/cgi-bin/test
0
 
LVL 38

Assisted Solution

by:yuzh
yuzh earned 166 total points
ID: 11724167
Have a look at this "Apache Tutorial: Dynamic Content with CGI"
http://webauthv3.stanford.edu/manual/howto/cgi.html
0
 
LVL 15

Assisted Solution

by:samri
samri earned 166 total points
ID: 11829060
micro_learner,

in addition to the link that yuzh provided, you need to ensure that the CGI program actuall runs.  The easiest thing would be trying to copy the cgi file to the standard CGI folder, and see if it runs there.

The error "Premature end of..." typically the result of incorrectly written CGI, or the CGI program is sending out wrong header.  try with a simple CGI (and adjust the perl line to match those on your system):

#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "Hello, World.";


and try to use Options +ExecCGI, this would cause the ExecCGI to be added to the existing optiosn - rather than replacing all previous options.

-- and if there is still problem - check server error_log, perhaps you could post it here.

cheers.
0
 
LVL 4

Expert Comment

by:TomDavidson
ID: 12146047
Split between all 3?
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question