Home > Archive > PERL Miscellaneous > August 2004 > PHP in a Perl Script
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
PHP in a Perl Script
|
|
|
| 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
| |
| Gunnar Hjalmarsson 2004-08-25, 5:05 am |
| 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
| |
| John Bokma 2004-08-25, 5:05 am |
| "Gary" <reachus@netlink.info> 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 :-D)
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
| |
| Richard Gration 2004-08-25, 9:00 am |
| In article <MATWc.141004$Oi.85750@fed1read04>, "Gary"
<reachus@netlink.info> 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
|
|
|
|
|