SuperMike
September 13th, 2007, 11:59 PM
I'm having an odd Apache2 problem where I can't add my own CGI language.
Okay, through Apache2, I can get my Perl scripts to run just fine from /var/www/test with their .pl extensions, but I had to do this:
1. sudo vi /etc/apache2/sites-enabled/000-default
I commented out with # the 'AllowOverride None' lines. Argh, cruel bastards be they.
2. sudo vi /var/www/test/.htaccess
I added these lines:
Options +ExecCGI
AddHandler cgi-script .pl
3. sudo /etc/init.d/apache2 restart
4. sudo chmod 755 /var/www/test/index.pl
5. I ensured the index.pl started with the following as the topmost line:
#!/usr/bin/perl
Okay, great, but now I wrote a new language called Polar and it has files that execute with .pol. The directive at the top of those scripts read:
#!/usr/lib/polar/polar
In the /usr/lib/polar directory is a Bash script called 'polar' that pre-processes the script and converts it from the "Polar" langauge I invented and into Javascript that can run through 'ngs-js' (an ELF binary that runs Javascript).
I then did all the numbered steps again but also changed step 2 to:
Options +ExecCGI
AddHandler cgi-script .pl .pol
If I do 'polar index.pol', it runs. If I do './index.pol', it does not run. If I try to hit the index.pol page in the browser, it reports an error:
500 Internal Server Error
However, if I make a .js file and call ngs-js directly with this technique, it works just fine. So what's the catch in making Apache2 know to run /usr/lib/polar/polar as the interpreter to my script?
Okay, through Apache2, I can get my Perl scripts to run just fine from /var/www/test with their .pl extensions, but I had to do this:
1. sudo vi /etc/apache2/sites-enabled/000-default
I commented out with # the 'AllowOverride None' lines. Argh, cruel bastards be they.
2. sudo vi /var/www/test/.htaccess
I added these lines:
Options +ExecCGI
AddHandler cgi-script .pl
3. sudo /etc/init.d/apache2 restart
4. sudo chmod 755 /var/www/test/index.pl
5. I ensured the index.pl started with the following as the topmost line:
#!/usr/bin/perl
Okay, great, but now I wrote a new language called Polar and it has files that execute with .pol. The directive at the top of those scripts read:
#!/usr/lib/polar/polar
In the /usr/lib/polar directory is a Bash script called 'polar' that pre-processes the script and converts it from the "Polar" langauge I invented and into Javascript that can run through 'ngs-js' (an ELF binary that runs Javascript).
I then did all the numbered steps again but also changed step 2 to:
Options +ExecCGI
AddHandler cgi-script .pl .pol
If I do 'polar index.pol', it runs. If I do './index.pol', it does not run. If I try to hit the index.pol page in the browser, it reports an error:
500 Internal Server Error
However, if I make a .js file and call ngs-js directly with this technique, it works just fine. So what's the catch in making Apache2 know to run /usr/lib/polar/polar as the interpreter to my script?