×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

CGI script doesn't execute correctly on web browser

CGI script doesn't execute correctly on web browser

CGI script doesn't execute correctly on web browser

(OP)
Hi,
I had just installed perl5 on my machine.  when i try to execute cgi script i.e xxx.cgi on browser, i will see the content of the source code and not the output.  My cgi script is stored same directory as my webpage i.e /htdocs/xxx/xxx.cgi.  Any advice on this?  


Thks with regards,
Adeline

RE: CGI script doesn't execute correctly on web browser

your question is a little vague, but, here's a guess....
assuming that you have a separate cgi directory and htdocs directory ( you should),
your web server should be configured to allow execution of programs in your cgi dir only.  Since your code is not in the cgi dir, your web server interprets it as a text file instead of an executable.  Try putting it in the cgi dir, and modifying the calling code
<Form Action="" Method""> to point at the cgi-bin dir.

RE: CGI script doesn't execute correctly on web browser

(OP)
Hi,
I tried to put it inside cgi-bin directory and tried to execute it directly from browser but still get the same result.  I configured my server as ScriptAlias /cgi-bin/ "/usr/local/apache/cgi-bin/"  and put my cgi script inside /usr/local/apache/cgi-bin.  Is this correct?  Pls advice.  Thks.


Rgds,
Adeline

RE: CGI script doesn't execute correctly on web browser

Adeline,
   Does the relevant section of your httpd.conf look similar to this..?  Meaning, are you also telling Apache to only execute that code and not serve it up as text?  Remember to restart httpd if you change the conf file (yea, I know that's dumb, but I forget all the time myself)...
   Scott

#
# ScriptAlias: This controls which directories contain server scripts.
# ScriptAliases are essentially the same as Aliases, except that
# documents in the realname directory are treated as applications and
# run by the server when requested rather than as documents sent to the client.
# The same rules about trailing "/" apply to ScriptAlias directives as to
# Alias.
#
ScriptAlias /cgi-bin/ "/usr/local/apache/cgi-bin/"

#
# "/home/httpd/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/usr/local/apache/cgi-bin/">
    AllowOverride None
    Options ExecCGI
    Order allow,deny
    Allow from all
</Directory>

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close