I want to include a PHP file inside a PERL file..

script1.pl

#!/usr/local/bin/perl

use strict;
use warnings;
use CGI qw(:standard);
use CGI::Carp qw(fatalsToBrowser warningsToBrowser);

print header();
warningsToBrowser(1);

print("<?php include('require_file.php') ?>\n\n");

It's in the source code, but it's never include my other php. How can I fixed that?
'require_file.php' is in the same directory the script1.pl is.

    does the require_file.php exists in the same folder as the perl script?
    try giving the exact location of the require_file.php

    also.. drop the <?php stuff. perl can include thoes files by it's self. however.. what is tricky.. is getting the web-server to see the script as php and excute it as php.. and not txt or perl.

    try hunting aroung google. i'm sure it's been done before.

    perhaps http://www.htmlgoodies.com/beyond/webmaster/article.php/3473341

      I try that link, when I try in .pl file, it doesn't do nothing.
      I also read this link, PERL in PHP

      <?php 
      
      print "Hello from PHP!\n"; 
      $perl = new Perl(); 
      $perl->require("script1.pl"); 
      print "Bye!\n"; 
      
      ?> 
      

      Give me this:

      Hello from PHP!
      Fatal error: Class 'Perl' not found in C:\Inetpub\webaps\test2.php on line 4

      I try include inside PHP script inside PERL script, doesn't work, so I try the PHP include of PERL file. No luck at all.

      Do I need to import Perl class from PHP or something?

        zend.com wrote:

        The PHP Perl extension was implemented to allow the usage of Perl code from within PHP.

        You need that extension for it to work. You can download it here.

          Write a Reply...