jponte has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I'm trying to install a CGI script to create and administer email lists. I am a beginner but I think I set everything OK. I gave full permissions to all files and folders. when I try using the script adding a new email address to the list I receive the error:

Empty/Missing/Bad Path to GMTime file

I put the file call gmtset.pl in the cgi-bin directory and gave proper permissions. A CGI file calls this gmtset.pl file this way

if ((-s "sets/gmtset.pl")) { require "sets/gmtset.pl";} else {print "Content-type: text/html\n\n"; print "Empty/Missing/Bad Path - GMTime file\n"; exit;}

I tried setting the path to the full URL http://www.mydomain.com/cgi-bin/sets/gmtset.pl but it did not work either.

I do not know what to do anymore. I called the hosting company and they said that I should be able to run it.

I would appreciate your help,

Jack

Replies are listed 'Best First'.
Re: Empty/Missing/Bad Path to GMTime file
by Corion (Patriarch) on Jul 08, 2005 at 10:54 UTC

    The problem is, that what you think is your "current directory", is likely not.

    Your webserver likely runs your script from the root directory (/), or within a chroot jail. Filenames in Perl are not URLs, so your attempt of using that to access your script was wrong. Likely you will need something like the following in your CGI script:

    use File::Basename; use File::Spec; use Cwd; my $base_dir = File::Spec->rel2abs(dirname $0); chdir $base_dir or die "Couldn't set '$base_dir' as working directory: $!";

    You should not be storing such configuration files under your cgi-bin directory - configuration data and other files should all reside in a directory outside of the document root. You should read up on how filenames, URLs and Perl work together.

Re: Empty/Missing/Bad Path to GMTime file
by Happy-the-monk (Canon) on Jul 08, 2005 at 10:54 UTC

    I tried setting the path to the full URL http://www.mydomain.com/cgi-bin/sets/gmtset.pl but it did not work either.

    You've got the right idea but your CGI script needs the local path on the webserver to that file, not its URL.

    It might look something like /usr/local/apache/cgi-binsets/gmtset.pl - try to find out the correct path.

    Cheers, Sören