A bit more info from me on what I’ve done. First off, PHP files run just fine without me doing anything - the LAMP side of things was set up when I did the Ubuntu installation, though in my case, as I’m not running more than a single site, all my web content sits in its default position under /var/www/html
. For example, the server’s home page looks like this…
No one ever accused me of not having a sense of humour, but moving swiftly on…
From a browser, I can point at 192.168.6.100
and pages com up exactly as I’d expect them to, and they’ve done so for the last 2-3 years this server has been in existence. So far so good, phpinfo.php works and so do a couple of other PHP oddities I’ve set up.
To get Perl running, I’ve followed the instructions in the page linked above from the point after phpinfo.php is tested, and have then adapted the directory path to follow where my web content lives, so…
- sudo aptitude install libapache2-mod-perl2
- sudo mkdir /var/www
- sudo mkdir /var/www/cgi-bin
- sudo nano /etc/apache2/sites-enabled/000-default.conf
- Then added…
ScriptAlias /cgi-bin/ /home/www/cgi-bin/
<Directory /var/www/cgi-bin/>
Options ExecCGI
AddHandler cgi-script cgi pl
</Directory>
…
6. cd /var/www/cgi-bin
7. sudo nano perltest.pl
8. Added the following content to the file…
###Start###
#!/usr/bin/perl -w
print "Content-type: text/html\r\n\r\n";
print "Hello there!<br />\nJust testing .<br />\n";
for ($i=0; $i<10; $i++)
{
print $i."<br />";
}
###End###
then…
9. sudo chmod a+x perltest.pl
Now, by going to 192.168.6.100/cgi-bin/perltest.pl
I just get the contents of the file itself presented to me.
If I run it from the CL though, I get this, which I gather is what I should get.
So Perl is definitely installed and functioning. It’s just getting it to run from a browser that seems to be the issue, pointing me back towards the Apache2 config again.