in reply to Perl and PHP interoperability

i've found myself in the same boat a number of times.

the following bit of code has come in handy once or twice.

my $tempfile = '/some/temp/directory/and/filename.php'; open( FILE, ">$tempfile" ); print FILE $output; close FILE; $output = `/usr/local/bin/php $tempfile` || die "Error: $!\n\n$output" +;
that will execute php from inside a perl script ..

edit: sorry, forgot to add, that code snippet assumes that you have an html/php page stored in $output. If you have a php page existing on your server that you just want to run, you can skip the whole output to file bit, and just use the my $output = `/usr/local/bin/php $pathtofile` bit to collect the output of that file.

i use the above code in my perl based CMS system when i need to display a preview of a page that contains php.

on the other hand:

<?php echo file_get_contents( 'http://www.domain.com/cgi-bin/something.cgi?r +m=this&value=that' ); ?>
will output the contents of a perl script executed from inside a php page.

hope that helps.