I need small virtual machine with a Web server, so I decided to install Damn Small Linux. I need to run a Web server that is hosting a site with a script that checks for a server's IP address and returns it in a HTML page. So far I have something like this working:
Script file:
#!/usr/bin/perl
print "Content-type: text/html\n\n" ;
print <<EOF ;
<html>
<head><title>CGI Results</title></head>
<body>
<h1>Hello, world.</h1>
</body>
</html>
EOF
exit ;
The script is called from HTML like this:
<iframe src="http://localhost/cgi-bin/skrypt.cgi" width="100%"></iframe>
It's working fine, but whenever I add something to this script other than a print
statement, for example:
my $address = "someValue"
… then the HTML page is not running the script but instead it is downloading it. What do I have to do to make this script work? I just need an IP address to appear on the Web page.