PERL/CGI & PHP include

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
vietboy505
Forum Commoner
Posts: 53
Joined: Wed Feb 22, 2006 9:30 am

PERL/CGI & PHP include

Post by vietboy505 »

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

script1.pl

Code: Select all

#!/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.
User avatar
ambivalent
Forum Contributor
Posts: 173
Joined: Thu Apr 14, 2005 8:58 pm
Location: Toronto, ON

Post by ambivalent »

Once perl runs the script, the result is output to the browser. PHP won't be aware of it.
vietboy505
Forum Commoner
Posts: 53
Joined: Wed Feb 22, 2006 9:30 am

Post by vietboy505 »

Is there any way to bypass that?

Because my config.php file is my layout page of the website.

Or the only way to hardcode my layout from config.php to PERL?
vietboy505
Forum Commoner
Posts: 53
Joined: Wed Feb 22, 2006 9:30 am

Post by vietboy505 »

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

Code: Select all

<?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?
Post Reply