|
"My Perl script works on my server but it does not work on
your server."
Here are some things that you can check first...
Check the path to Perl, which should be "/usr/local/bin/perl".
Verify that you have uploaded the script in ASCII mode.
Check for case sensitivity and spelling in the code or of the file
names.
Check the permissions on the .cgi files. They should be executable, i.e.
permissions set to "755".
It is also recommended that you run a script to check the
environment of the server. Take for example, you can create a script
named "printenv.cgi", and put the lines below in the script, upload to
the server inside the "htdocs" folder, and execute it by going to
http://www.my-domain-name/printenv.cgi.
Contents of "printenv.cgi"
#!/usr/local/bin/perl
print "Content-type: text/plain; charset=iso-8859-1\n\n";
foreach $var (sort(keys(%ENV))) {
$val = $ENV{$var};
$val =~ s|\n|\\n|g;
$val =~ s|"|\\"|g;
print "${var}=\"${val}\"\n";
}
After you have executed the script by going to
http://www.my-domain-name/printenv.cgi, please note the output. It
is also a good idea to run the same script in your test server.
Some settings that you should watch out for:
DOCUMENT_ROOT : This shows you the absolute path in the
server. Most probably it will be different for your test server. If you
use absolute paths in your script, please edit them to reflect the live
server's environment.
PATH_TRANSLATED and SCRIPT_NAME : Notice that we have
passed your script through a wrapper. This means that your script will
be executed under your permissions. This is more secure, and it allows
you to write into your own files and directories without setting them as
world-writable. However, the wrapper may have some unexpected effects on
some scripts. For security reasons, we cannot remove the wrapper. So if
you are affected by this, you will need to modify your scripts so that
it is independent of such environment settings.
|