LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 12-30-2003, 11:51 PM   #1
Zaknafien
LQ Newbie
 
Registered: Dec 2003
Location: Alaska
Distribution: Fedora Core 2
Posts: 2

Rep: Reputation: 0
Apache CGI Problem : Browser not running script


Ive been looking around this site for days looking for anything remotely resembling this problem and have not had any luck.

Here is the problem. When I try to run my test script from the Browser (galeon and IE on a different computer) the browser wont execute it they try to download the script. (i.e. - typing "mysite.com/cgi-bin/first.cgi" the "DocumentRoot" is /mysite/ into the location in the browser) Which is not exactly I must say what I want. I have used "ScriptAlias" to make the cgi's able to run in my cgi-bin directory and used "AddHandler" to tell it to run scripts with .cgi and .pl extensions. I am using Apache 2.x. I cant seem to figure out why it is not running the script. Any Ideas? Anybody?

My cgi script first.pl (I even tried renaming it first.cgi - didnt matter still does same effect) -

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

-End of script -

My vhosts config file portion (IP's and Domains edited)-

################# Vhosts.conf
#This is where we store the VirtualHosts configuration.
#
#Since Apache 1.3.19, we modified the setup to include some nice tricks:
#
#- We added the User and Group directives so VirtualHosts now work with
# suexec directive. If set, Apache will run all cgi scripts under that
# user and group (provided the uid and gid are > 100 for security). The
# directories and cgi files *must* belong to that user/group for the
# feature to work
#- We added the Setenv VLOG directive. This works in conjunction with
# the CustomLog in common.conf. When Setenv VLOG is set, apache will
# create a /var/log/httpd/VLOG-YYYY-MM-<ServerName>.log instead of logging
# to access_log. Use this instead of defining a special logfile for
# each vhost, otherwise you eat up file descriptors.
#- You can also specify a path for the VLOG for each Vhost, for example,
# to place the logs in each user's directory. However, if you want to
# use the file for accounting, place it in a directory owned by root,
# otherwise the user will be able to erase it.
#- I suggest only including the ErrorLog *only* if the vhost will use
# cgi scripts. Again, it saves file descriptors!
#- We added the Rewrite directives so vhosts will work with the
# PERLPROXIED configuration

NameVirtualHost xxx.xxx.xxx.xxx
<VirtualHost xxx.xxx.xxx.xxx>
ServerName site1.com
ScriptAlias /cgi-bin/ /var/www/html/hosts/site1/cgi-bin/
DocumentRoot /var/www/html/hosts/site1
Options ExecCGI
AddHandler cgi-script cgi pl
</VirtualHost>

<VirtualHost xxx.xxx.xxx.xxx>
ServerName site2.com
ScriptAlias /cgi-bin/ /var/www/html/hosts/site2/cgi-bin/
DocumentRoot /var/www/html/hosts/site2
Options ExecCGI
AddHandler cgi-script cgi pl
</VirtualHost>

<VirtualHost xxx.xxx.xxx.xxx>
ServerName site3.com
ScriptAlias /cgi-bin/ /var/www/html/site3/cgi-bin/
DocumentRoot /var/www/html/hosts/site3
Options ExecCGI
AddHandler cgi-script cgi pl
</VirtualHost>

<VirtualHost xxx.xxx.xxx.xxx>
ServerName site4.com
DocumentRoot /var/www/html/hosts/site4
</VirtualHost>

-End of Vhosts config file -
 
Old 12-31-2003, 12:01 AM   #2
techrolla
Member
 
Registered: Nov 2003
Distribution: Gentoo, Debian
Posts: 188

Rep: Reputation: 30
check the apache logs, in the apache folder. I have this same problem, although I forgot about it with jsp and php, but the reason my logs gave were because there was some incorrect header or something. so maybe search around for bad header problems with apache and perl.
 
Old 12-31-2003, 12:57 AM   #3
Zaknafien
LQ Newbie
 
Registered: Dec 2003
Location: Alaska
Distribution: Fedora Core 2
Posts: 2

Original Poster
Rep: Reputation: 0
Thank you for your help techrolla. I figured out what it was though for those that would like to know or are having this particular problem. I had written (accidentally) an empty space between the start of the cgi and the "#/usr/bin/perl" statement... I deleted the empty space and viola! everything works as it is supposed to. Now on to making some real cgi's.
 
Old 12-31-2003, 01:16 PM   #4
techrolla
Member
 
Registered: Nov 2003
Distribution: Gentoo, Debian
Posts: 188

Rep: Reputation: 30
heh, cool, np. Im gonna see if I did the same thing...
 
  


Reply


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
Probs running .jar file via CGI script under Apache blimbo Programming 1 07-22-2004 10:29 AM
Apache cgi-script problem palanisaravanan Linux - General 6 02-07-2004 09:41 AM
Have problem running .pl perl script in apache adrianmak Linux - Software 4 11-10-2003 09:31 AM
cgi running on apache foop37 Linux - Newbie 1 08-06-2003 09:34 AM
Running a shell script via CGI-BIN chrisk5527 Linux - General 3 05-09-2003 11:44 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:29 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