Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PERL and PHP 1

Status
Not open for further replies.

jstreich

Programmer
Apr 20, 2002
1,067
US
Is HTML generated from CGI scripts (Perl, c++) passed through the PHP intrepter when being served? In other words, what is the order of the piping and filitering when serving a CGI?
 
Most webservers don't pass content through multiple filters, (except perhaps SSI, in certain instances) but this is possible with Apache 2. (See 'Filtering' at
With Apache 2, you can decide for yourself which order you want your output OR input stream filtered. Pretty cool, but a totally new concept, requiring the admin to learn some new configuration techniques.

So, if you are using Apache 1.x, or most other webservers, you are limited to one level of output manipulation, meaning that CGI programs cannot then produce PHP code which will be parsed by PHP, if that is what you are asking.

However, there is always a work-around for things. If you really need to take the output of a CGI and run it through a PHP interpreter, you can instruct PHP to include() the page as an external HTTP URL, for example
Code:
include('[URL unfurl="true"]http://localhost/cgi-bin/specialpage.cgi?param1=value1&etc=more');[/URL]
. This means that PHP will 'pretend' to be a web browser, and grab the page over an HTTP connection, after it has been parsed by the CGI program. As long as the CGI program outputs valid PHP, with tags, etc... then this will work. Beware, though: allowing HTTP access to raw PHP code can be a big security risk, and it also doesn't have the best server performance implications. -------------------------------------------

My PostgreSQL FAQ --
 
Hmmmm... The issue is this: I have a PHP based site, but am using a Perl chess game on my site (Beholder's Chess Board, to be spesific), and thus the pages produced need a form of navigation, since the site has dynamic content (feed from a db) the navigation chages... So I'd like to just include a navigationbar... (a simple table, with links)... I suppose just giving them a way back to the main page (where full navigation is possible) will have to do.

I can see a lot of other applications for feeding it through several filters, though it sounds like too much trouble (even with the latest version of Apache)...

Thanks for the answer.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top