Running Perl from PHP via PHP virtual function
Stephen Collyer
scollyer at netspinner.co.uk
Wed Jan 4 17:20:41 GMT 2006
I have website access/auth control code that is written
in Perl and currently works under CGI and mod_perl.
I'd like to add some kind of PHP support in there too,
and it strikes me that this can be done fairly painlessly
using PHP's virtual function (assuning that PHP is available
via mod_php, that is).
The idea is that I'd have a trivial Perl script that runs the
access/auth control code (e.g. gateway.pl), and I'd funnel all
requests to gateway.pl via a trivial PHP script that runs
something like:
virtual("/some/dir/gateway.pl");
virtual("/the/real/target/of/the/request");
and the funnelling would be done via a mod_rewrite directive
in a suitably placed .htaccess file. The PHP script would
have to construct the /the/real/target/of/the/request on the
fly from params supplied via mod_rewrite. gateway.pl would
either emit nothing, or redirect to a login page.
In this way, I'd get the ability to protect any type of
resource on a web site with full reuse of existing Perl
code, as long as it's running mod_php.
Or am I missing some fundamental difficulty ?
--
Regards
Stephen Collyer
Netspinner Ltd
More information about the london.pm
mailing list