How to make Perl/CGI script parse and execute PHP script in HTML file?

stndn

Golden Member
Mar 10, 2001
1,886
0
0
Is there a way to control/execute PHP commands from CGI script written in Perl?

Suppose i have three files:
- /cgi-bin/script.cgi
- /template.php
- /includes.php

where the file template.php have these lines:
...some html goes here...
<?php
include ("includes.php");
?>
...some more html goes here...



what i want to accomplish is:
When i connect to http://www.blahblahblah.com/cgi-bin/script.cgi, i want the cgi-script to read and print the contents of template.php to the browser, while still be able to process the PHP command (include ("includes.php"))

So in the end, i want script.cgi to output:
... some html from template.php ...
... some result from includes.php ...
... some more html from template.php ...


instead of:
...some html from template.php...
<?php
include ("includes.php");
?>
... some more html from template.php...


How can i accomplish this? What command(s) do i need to use in Perl so the cgi script can parse and execute the PHP file?

Thanks.
 

stndn

Golden Member
Mar 10, 2001
1,886
0
0
At this moment, yes there are reasons for not doing them all in one language.
I have working CGI script that i still want to use.
On the other hand, i have designed template file in PHP that will display webpages and including contents for the <head> and footer information and what not

I will eventually move the CGI script to PHP script ... but it may take a long while before i get around to doing that.

If there's no way of achieving what i wanted, probably i'll just end up not using the template.php in my cgi script, and have to use plain html file like i am doing now ...
 

cyberphant0m

Member
Oct 21, 2003
99
0
0
If i were you, I would probably translate one of the two scripts into the other... probably the PERL into PHP, since PHP (IMHO) is better suited for web-scripting...