I have a perl form email script on the servers cgi-bin directory ( /usr/lib/cgi-bin ).


ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
    AllowOverride None
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    AddHandler cgi-script cgi pl
    Order allow,deny
    Allow from all

The issue is with paths.

html calls script here:

<form name="Request" method="post" action="http://server-test.local/cgi-bin/formprocessorpro.pl" onsubmit="return checkWholeForm49874(this)">

The directory with the templates and configs is passed here:

<input type="hidden" name="base_path" value="../contact" />

The path to this form is:


No matter what variation I try for the base_path I get an error from the formprocessor script that it can't find the directory:

An error occurred when opening the Form Configuration File (../contact/form.cfg): No such file or directory.

I need to move this script from an old server, configured by a previous sysadmin, to a new server.

Since cgi-bin is automatically linked to /usr/lib/cgi-bin and linked such that the script resides:


I would imagine that, given that the templates are in the webroot in a directory called contact, the correct path would be:


Any ideas? It's been awhile since I've messed with CGI.

* UPDATE * It works if I put the templates in or in the vicinity of the actual cgi-bin directory. Debian symlinks cgi-bin to /usr/lib/cgi-bin and apparently the form mail script wasn't informed of this. If this solution suits you, silence is welcome, otherwise, flame me and suggest a different strategy. Thanks!

* UPDATE pt. 2 * The path passed works if /var/www/. Shouldn't CGI scripts be able to follow links in apache's conf files?


1 Answer 1


A CGI's working directory is the directory it resides in. The "base_path" in your CGI is probably accessing files through the fileystem, not via any webserver.

You never mentioned where the files it needs to open actually live, so it's hard to tell you what a decent relative path would be.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .