Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CGI script doesn't execute correctly on web browser

Status
Not open for further replies.

adelinewss

Programmer
May 22, 2000
20
0
0
SG
Hi,<br>I had just installed perl5 on my machine.&nbsp;&nbsp;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.&nbsp;&nbsp;My cgi script is stored same directory as my webpage i.e /htdocs/xxx/xxx.cgi.&nbsp;&nbsp;Any advice on this?&nbsp;&nbsp;<br><br><br>Thks with regards,<br>Adeline
 
your question is a little vague, but, here's a guess....<br>assuming that you have a separate cgi directory and htdocs directory ( you should),<br>your web server should be configured to allow execution of programs in your <i>cgi</i> dir only.&nbsp;&nbsp;Since your code is not in the <i>cgi</i> dir, your web server interprets it as a text file instead of an executable.&nbsp;&nbsp;Try putting it in the cgi dir, and modifying the calling code <br>&lt;Form Action=&quot;&quot; Method&quot;&quot;&gt; to point at the cgi-bin dir.<br><br>
 
Hi,<br>I tried to put it inside cgi-bin directory and tried to execute it directly from browser but still get the same result.&nbsp;&nbsp;I configured my server as ScriptAlias /cgi-bin/ &quot;/usr/local/apache/cgi-bin/&quot;&nbsp;&nbsp;and put my cgi script inside /usr/local/apache/cgi-bin.&nbsp;&nbsp;Is this correct?&nbsp;&nbsp;Pls advice.&nbsp;&nbsp;Thks.<br><br><br>Rgds,<br>Adeline
 
Adeline,<br>&nbsp;&nbsp;&nbsp;Does the relevant section of your httpd.conf look similar to this..?&nbsp;&nbsp;Meaning, are you also telling Apache to only execute that code and not serve it up as text?&nbsp;&nbsp;Remember to restart httpd if you change the conf file (yea, I know that's dumb, but I forget all the time myself)...<br>&nbsp;&nbsp;&nbsp;Scott<br><br>#<br># ScriptAlias: This controls which directories contain server scripts.<br># ScriptAliases are essentially the same as Aliases, except that<br># documents in the realname directory are treated as applications and<br># run by the server when requested rather than as documents sent to the client.<br># The same rules about trailing &quot;/&quot; apply to ScriptAlias directives as to<br># Alias.<br>#<br>ScriptAlias /cgi-bin/ &quot;/usr/local/apache/cgi-bin/&quot;<br><br>#<br># &quot;/home/httpd/cgi-bin&quot; should be changed to whatever your ScriptAliased<br># CGI directory exists, if you have that configured.<br>#<br>&lt;Directory &quot;/usr/local/apache/cgi-bin/&quot;&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;AllowOverride None<br>&nbsp;&nbsp;&nbsp;&nbsp;Options ExecCGI<br>&nbsp;&nbsp;&nbsp;&nbsp;Order allow,deny<br>&nbsp;&nbsp;&nbsp;&nbsp;Allow from all<br>&lt;/Directory&gt;<br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top