0

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

/etc/apache2/sites-enabled/000-default

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
</Directory>

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:

http://server-test.local/formstest/contact.htm

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:

http://server-test.local/cgi-bin/formprocessorpro.pl

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

../contact

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?

Bubnoff

1 Answer 1

0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.