note 13245 deleted from function.exec by vincent

From: Date: Fri, 12 Sep 2003 06:38:14 +0000
Subject: note 13245 deleted from function.exec by vincent
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-56315@lists.php.net to get a copy of this message
Note Submitter: andrei@ucar.edu ---- Thanks to marat@provote.com who submitted a note about passing parameters from perl script back to php script with "exec". "exec" works just fine if you need to execute perl script from your php code once in a while. But if you want to optimize perl performance, you want to run it under mod_perl, right? You can use "fopen" in this case. The perl script runs under mod_perl and just prints out the variables it wants to pass to php script: #!/usr/local/bin/perl -w use strict; use CGI qw(-compile :all); my $q = CGI->new(); print($q->header()); print "It worked!!!\n"; if(exists $ENV{MOD_PERL}) { print "we're running under mod_perl\n"; } else { print "we're NOT running under mod_perl\n"; } print "parameter1\n"; print "parameter2"; PHP script just calls this script with fopen and uses fgets to retrieve the output: $fp = fopen ("http://your.website.com/perl/perlscript.pl", "r"); $i=0; while (!feof($fp)) { ${"par$i"} = fgets ($fp,4096); echo "parameter $i: ${"par$i"}"; $i++; }

« previous php.notes (#56315) next »