[Zope] How to serve php from within Zope
Andres Corrada
andres@corrada.com
Fri, 24 Mar 2000 11:45:05 -0500
Scott Parish wrote:
>
> Actuatly, there may be one other quicker method to do this. You can somehow
> (i haven't tried this) compile php into a stand alown executable. Then you
> could then have an external method do a shell call running the php script.
> Another interesting thing you could do would be to make a zope product that
> stored php3 code, and then called out to php to parse it. This might not be
> a bad way to allow clients to have their own maintainable php3 scripts up
> on the web without giving them ftp or shell access. hmm..
>
> sRp
>
> --
> Scott Parish
> http://srparish.net
I've implemented a variant of Michel's suggestion. Let me explain what I
am trying to do. I'm trying to implement the
SelfServeFAQ:www.lcg.org/ssfaq (SSF),written in php3, within my Zope
website. To give a consistent look to my site, I also want to wrap the
SSF with standard_html_header, etc. So when a visitor goes to
www.mysite.com/FAQ they are really being served
/SSF/directory/index.php3 wrapped with my Zope code.
The problems come when a user clicks on www.mysite.com/FAQ/add.php3 or
some such similar link in the HTML produced by index.php3. I tried using
mod_rewrite in Apache, but found that Zope used
www.mysite.com/FAQ/add.php3 as the base for all the links in the
wrapping code. The only way I found to avoid this was to use the "[R]"
flag in the Apache RewriteRule.
But I want SSF to be transparent to the user so instead I used
SiteAccess to rewrite /FAQ/add.php3 to /FAQ and pass /FAQ/index_html the
script name "add.php3". index_html then uses lstaffor's How-To tip( use
"Client.call( www.mysite.com/SSF/directory/add.php3)[ 1 ]" ) to embed
the PHP script call in my Zope page. In addition, I wrote additional
code in my accessRule to pass images in the PHP directory tree via Zope.
There is one inconveniences with this approach: I had to hack SSF to
remove the <html> tags and some others returned by Client.call (it
worked otherwise but, hey, I want my HTML code to be clean). But all in
all, the resources of Zope (the code and the community around it)
allowed me to solve the problem with very little modification of the SSF
PHP directory tree contents.
If there is wider interest on this I could write a How-To on it.
Andres Corrada