TheRaiderNation
Spartan
I've recently installed Apache Server 2.2 and the latest version of Perl on an old computer I had lying around. The server is running and connected to the internet and I can access files inside of /htdocs/ and run scripts from /cgi-bin/ no problem. The issue comes in when I'm trying to run a script that tries to read a file from the server.
In other words a script that simply prints "Hello World" will work, but a script that tries to read in Hello World from a file and then print it out won't work.
Here is the script I am using:
If I try http://[server-ip]/cgi-bin/FileReader.pl I'll get a 500 Internal Server Error. However, execute it via cmd the script works and prints out the Hello World.
Thanks in advance
EDIT: So I update the script, it no longer attempts to read from a file, rather write to an existing file and create a new file. Odd thing is that I'm still getting a 500 Error, but the script seems to work, it creates a new file on the server and modifies the existing one. Any idea why I'm still getting the 500 error though?
In other words a script that simply prints "Hello World" will work, but a script that tries to read in Hello World from a file and then print it out won't work.
Here is the script I am using:
Code:
#!c:/per/bin/perl.exe
## Basic file reader
$file = '../htdocs/helloworld.txt';
open(INFO, $file);
while(<INFO>)
{
chomp;
print "$_\n";
}
close(INFO);
If I try http://[server-ip]/cgi-bin/FileReader.pl I'll get a 500 Internal Server Error. However, execute it via cmd the script works and prints out the Hello World.
Thanks in advance
EDIT: So I update the script, it no longer attempts to read from a file, rather write to an existing file and create a new file. Odd thing is that I'm still getting a 500 Error, but the script seems to work, it creates a new file on the server and modifies the existing one. Any idea why I'm still getting the 500 error though?