2007/12/17

PHParser with Plone

PHParser 是 Zope 系統裡的一個模組,讓 PHP script 能直接在 Zope 或 Plone 環境執行,包括 cookie/session 與 file uploading 都有支援。運作原理是先將原始碼交由 DTML engine 處理,再交給 PHP CGI 程式執行,最後再顯示出來。另外搭配 PHPGateway 後,還可以直接與 phpMyAdmin 溝通。

和一般模組安裝方式相同,下載檔案並解開到 Product 目錄裡,在 Plone 2.5 以上的環境,還需要啟動 five:traversable 設定,可以在 CMFPlone/configure.zcml 裡加上

<five:traversable class="Products.PHParser.PHParser.PHParser" />

這一行,重新啟動 Zope 即可。在 Win32 環境裡,我下載了 PHP binary 並把 Products\PHParser\PHParser.py 檔案裡的 PHPath 由原本的 php.exe 改為 PHPath = "d:\\php\\php-cgi.exe" 作為 Zope 的外部程式,成功執行。

No comments: