Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 279
  • Last Modified:

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

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
micro_learner
Asked:
micro_learner
3 Solutions
 
TomDavidsonCommented:
Do cgi applications work on the main location (without the /~user/)?
0
 
micro_learnerAuthor Commented:
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
 
TomDavidsonCommented:
Try:
AddHandler cgi-script cgi pl
instead of:
SetHandler cgi-script
in the <Directory> block
0
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

 
micro_learnerAuthor Commented:
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
 
yuzhCommented:
Have a look at this "Apache Tutorial: Dynamic Content with CGI"
http://webauthv3.stanford.edu/manual/howto/cgi.html
0
 
samriCommented:
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
 
TomDavidsonCommented:
Split between all 3?
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now