OK, so here's my situation :
.xxx
) to be first handled by my interpreterHere's what I've tried so far (other than... messy solutions with exec
via PHP... lol) :
.htaccess
Options -ExecCGI -MultiViews -Includes -Indexes FollowSymLinks
Action lgm-cgi /usr/local/bin/lgm -c
AddHandler lgm-cgi .lgml
But guess what : It's not working.
I'm requesting www.mydomain.com/index.lgml
and instead of returning the processed file, it returns the very same file (index.lgml
) as text.
What am I doing wrong? Any suggestions?
I don't consider myself anywhere close to an expert regarding server configuration and .htaccess so I suppose this whole thing might be much easier than I expect; so please shed some light! :-)
You have mixed two distinct concepts: handlers and actions. You'd have to write a module to introduce new handler into the httpd server. After that, you'd have to use AddHandler or SetHandler to actually bind it with certain file type and/or URL space.
You would have to double check your error logs, but I suspect that while serving the .lgml file Apache figured out, that lgm-cgi handler doesn't exist and fell back to default-handler, which served your file as flat text.
You are correct however, to use Action here as it is appropriate. You just need to use it a bit differently. First, you should introduce a custom type for your file:
AddType application/lgml .lgml
...then associate that type with your action:
Action application/lgml /usr/local/bin/lgm -c
This should work.
EDIT: As pointed out by kbro, 2nd argument to Action
should be a CGI Script. So you'd have to write one (lets say /cgi-bin/lgm-handler.sh
) which would call /usr/local/bin/lgm
under the hood. Then you would introduce it into the server as such:
Action application/lgml /cgi-bin/lgm-handler.sh