I have a function written in PHP and would like to call this inside a CGI script. Is there any direct way to do this?
I am not sure if its even possible. The CGI script will be inside cgi-bin
directory 开发者_开发百科and the PHP function will be outside this folder.
I guess you could try to use Inline::Interp or PHP, however, I am not sure I see the point, given the overhead involved in invoking yet another interpreter in a CGI script.
have you tried via Command Line like so:
open DATA, "/path/to/you/bin/php you_script.php |" or die "Whoops: $!";
Try to use PHP::Interpreter :
use PHP::Interpreter;
my $p = PHP::Interpreter->new();
$p->include("some_php_include.php");
my $val = $p->somePhpFunc($perlVal);
精彩评论