Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > PHP in a Perl Script

Reply
Thread Tools

PHP in a Perl Script

 
 
Gary
Guest
Posts: n/a
 
      08-25-2004
I am calling a perl script that writes a WEB page - Plain and simple except
that the perl script also writes out some PHP processing. All works fine
when I just create an html file of the program but when I use perl to write
it the php tags are ignored ?

I have the apache Xbithack on so php is parsed for all html files and the
perl script says it is an html file as below.

This code is called from a WEB page

#!/usr/local/bin/perl
print <<END;
Content-type: text/html

<?php
SCRIPT etc etc
?>
END

PHP tags are just printed on the screen.

Any pointers.
Gary



 
Reply With Quote
 
 
 
 
Gunnar Hjalmarsson
Guest
Posts: n/a
 
      08-25-2004
Gary wrote:
> I am calling a perl script that writes a WEB page - Plain and
> simple except that the perl script also writes out some PHP
> processing. All works fine when I just create an html file of the
> program but when I use perl to write it the php tags are ignored ?


Doesn't PHP require the file extension .php?

Btw, what has your question to do with the Perl programming language?

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
 
Reply With Quote
 
 
 
 
John Bokma
Guest
Posts: n/a
 
      08-25-2004
"Gary" <(E-Mail Removed)> wrote in
news:MATWc.141004$Oi.85750@fed1read04:

> I am calling a perl script that writes a WEB page - Plain and simple
> except that the perl script also writes out some PHP processing. All
> works fine when I just create an html file of the program but when I
> use perl to write it the php tags are ignored ?
>
> I have the apache Xbithack on so php is parsed for all html files and
> the perl script says it is an html file as below.
>
> This code is called from a WEB page
>
> #!/usr/local/bin/perl
> print <<END;
> Content-type: text/html
>
> <?php
> SCRIPT etc etc
> ?>
> END
>
> PHP tags are just printed on the screen.


Just a wild guess, I think this by passes the webserver. The webserver
does the execution of PHP and it is being asked to execute (Perl) CGI
now.

If that's the actual script you are using, why? What can you do in PHP
you can't in Perl (ok, I am kidding )

Post real code, and ask real questions.

--
John MexIT: http://johnbokma.com/mexit/
personal page: http://johnbokma.com/
Experienced programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
 
Reply With Quote
 
Richard Gration
Guest
Posts: n/a
 
      08-25-2004
In article <MATWc.141004$Oi.85750@fed1read04>, "Gary"
<(E-Mail Removed)> wrote:


> I am calling a perl script that writes a WEB page - Plain and simple
> except that the perl script also writes out some PHP processing. All
> works fine when I just create an html file of the program but when I use
> perl to write it the php tags are ignored ?
> I have the apache Xbithack on so php is parsed for all html files and
> the perl script says it is an html file as below. This code is called
> from a WEB page
> #!/usr/local/bin/perl
> print <<END;
> Content-type: text/html
> <?php
> SCRIPT etc etc
> ?>
> END
> PHP tags are just printed on the screen. Any pointers.
> Gary
>


I assume this is on Apache ...

If it's Apache 1.x then the output of your script is parsed for the
presence of a couple of specific headers, which are added if they aren't
there (this is part of the CGI spec) and then sent on it's way to the
browser. It is not possible in Apache 1.x to have this output handed off
to another module for processing (here the request has been served by the
cgi-script handler - you cannot then chain to the php-script handler, not
in Apache 1.x).

However, in Apache 2.x it *is* possible. Not sure how you go about it in
httpd.conf 'cos I don't use it (<aside>Is mod_perl 2.x finished
yet?</aside>), but this is one limitation which was addressed
specifically when designing Apache 2.x, you can now chain content
handlers so that you can have the output of scripts parsed for SSI, have
perl scripts generate php, have SSI generate php which generates perl
(maybe and other full-on wackiness.

HTH
Rich
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: getting perl and php to talk to each other, was Re: randomlysorting files in php M. Strobel Perl Misc 1 03-05-2013 07:20 PM
PHP Training Institute In Delhi, Live Projects on PHP. Short TermPHP Courses, PHP Scripts, PHP Training with Live Projects. Rajive Narain Java 0 09-18-2009 10:47 AM
PHP/Perl/Unix Virus: delete config.php files asap Ignoramus6539 Perl Misc 2 08-30-2006 08:22 PM
Perl Help - Windows Perl script accessing a Unix perl Script dpackwood Perl 3 09-30-2003 02:56 AM
How to make Perl Script "POST" call from another Perl Script??? Wet Basement Perl 1 07-15-2003 10:25 PM



Advertisments