Calling CGI script from HTML

XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).

Moderator: General Moderators

Post Reply
levhal
Forum Newbie
Posts: 1
Joined: Sat Feb 03, 2007 3:40 am

Calling CGI script from HTML

Post by levhal »

I have a form that calls a CGI script:

Code: Select all

<form method=post action="engine.cgi">
My provider has informed me that I can use CGI scripts and that they must be placed under the cgi-bin directory which is below the root.
My webroot is: /usr/local/psa/home/vhosts/...domain.../httpdocs/
My cgi-bin directory is: /usr/local/psa/home/vhosts/...domain.../cgi-bin/

This code does NOT work:

Code: Select all

<form method=post action="/usr/local/psa/home/vhosts/...domain.../cgi-bin/engine.cgi">
Error which I received:
The requested URL /usr/local/psa/home/vhosts/...domain.../cgi-bin/engine.cgi was not found on this server.

I have tested the paths and this code DOES work:

Code: Select all

<?php
include ('/usr/local/psa/home/vhosts/...domain.../httpdocs/inc.php');
?>
Is there anybody that can help me to make this form work?:

Code: Select all

<form method=post action="/usr/local/psa/home/vhosts/...domain.../cgi-bin/engine.cgi">
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

You're giving full server paths to the file.. a http request will look for that under the web root directory. So your path is actually wrong.

getcwd() and $_SERVER['DOCUMENT_ROOT'] may be of help in creating the correct path.
Post Reply