You are not logged in Log in Join
You are here: Home » Members » hewei » PHParser/PHPGateway » PHParser-0.9.0 » PHParser 0.9.0 Release Information » View Document

Log in
Name

Password

 

PHParser 0.9.0 Release Information

PHParser - A Gateway to PHP!

PHParser gives you the chance to reuse your old PHP-scripts from the days before you experienced ZOPE and Python. PHParser tries to be a clean and stable product for production environments. Nevertheless you should use PHParser with care! PHP is a mighty language!! Take all precautions (e.g. edit php.ini in order to disable system-critial functions from PHP) to avoid trouble on your server!!! Never give untrusted users the right to add PHParsers in your ZOPE-installation!!!! Learn PYTHON and forget PHP!!!!!

PHParser is a ZOPE-Product which is based heavily on the DTML-Document-Class. A PHParser will give you all the features of a DTML-Document + all the features of PHP. This means that you can mix DTML into your PHP-Code.

PHParser is a real subclass of the DTML-Document-class. So you can use Cache-Managers, FTP, WebDav and so on a PHParser. To state it clearly: PHParser only modifies the __caller__-function from the DTML-Document-class, the rest is acquired from the DTML-Document-class.

PHParser works as a postprocessor: After rendering all DTML-tags in your document, PHParser will pipe the result through an external PHP-Interpreter.

PHParser emulates the pure PHP environment by rewriting PHP global variables, including $HTTP_GET_VARS, $HTTP_POST_VARS, $HTTP_SERVER_VARS, and etc. And this rewriting also includes the new global variables such as $_GET and $_POST introduced in PHP 4.1.0.

Most stand-alone scripts will work without changes. But for scripts using include/require functions, please refer to How to make include/require functions work in PHParser.

The header and body of the returned result will be decoded, so you can use PHP-'Header'-functions. This is useful for redirects {Header(Location: http://www.zope.org/)} and the creation of images:

   <?php

    Header( "Content-type: image/png");
    $image = imagecreate(100,16);

    $white = ImageColorAllocate($image,255,255,255);
    $grey = ImageColorAllocate($image,50,50,50);

    ImageString($image,3,0,0,"powered by PHP",$grey);
    ImagePNG($image);
    ImageDestroy($image);
   ?>

The php codes are interpreted by the "php" execution file. If users have build PHP as an Apache Module, this file doesn't exist. In other words: You have to compile/install PHP as a Command-Line-Intepreter and make sure that ZOPE can execute it.

Please send an email to Wei He if you like this product or have any comments/questions/proposals about it.