[ back to toc ]

calling an executable via cgi script

Date: 2002/02/25 13:59

Q:
Hello Peter!!!
I have the following problem:
in cgi-bin folder there is a script that calls for another perl script in
another directory.
The perl script calls for an executable on the same directory.
This executable is supposed to create some files, however each time it
prints on the screen- unable to open file ...
I've written a very simple program which creates a small file and prints
into it the word "hello". This small programm is reached in the same
manner, meaning:
cgi script->perl script -> executable. This time, the file is created
properly.

My question is, what could be the problem , and how should I solve it???

Regards,
*NAME-DELETED* Sandler,
QBI,Israel
A:
When programming CGI programs, you should never ever assume what the
default directory is. Allways, *ALWAYS* use absolute file names.

Try to make your programs parametrized saying

$Root = "/home/oded/public_html/cgi-bin/";
$my_file = $Root & "myfile.txt";

but should you use allways full path to the file names.

Regards,
Peter

[ back to toc ]