Page 1 of 1

Calling CGI script from HTML

Posted: Sat Feb 03, 2007 4:02 am
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">

Posted: Sat Feb 03, 2007 7:58 am
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.