How to serve pages through multiple frameworks/template engines efficiently

Posted by Leftium on Server Fault See other posts from Server Fault or by Leftium
Published on 2011-01-06T08:09:11Z Indexed on 2011/01/06 8:55 UTC
Read the original article Hit count: 332

Filed under:
|
|
|
|

I would like to render a file that has both PHP tags and Web2Py tags mixed together.

To do this, I would like the web server to pass the file through Web2Py, then PHP. I found a method to call PHP from Web2py via Python (based on this method for running PHP on top of django), but this method loses the benefits of any server optimizations from mod_php or FastCGI like caching and multi-threaded operation. A new process is created for each PHP request, which is very slow.

Is there a better way to efficiently render pages with both Web2Py(Python) and PHP tags in the same file? Note I am not looking for methods of serving PHP-only and Web2Py-only files from the same server/domain. I prefer solutions for Apache2 or Cherokee. I'm open to using other web servers, though.

Background info: I prefer to develop in Web2Py, but we have this pre-existing system written in PHP. I would like to augment the PHP system with some of Web2Py's features like auth authentication/user management and the T() internationalization object. Also it would make it much easier to port the PHP project to Web2Py if it could be done piecemeal. Since the PHP project consists of many files, it would greatly help if they did not need modification.

© Server Fault or respective owner

Related posts about php

Related posts about apache2