The relevant class constructor is called, if available, according to PHP specification, that is different between v4 and v5. The v4 constructor has identical name with the class name; the v5 constructor can also be named __construct.

PHP::Entity->tie($array_handle, $tie_to)

Ties existing handle to a PHP entity to either a perl hash or a perl array. The tied hash or array can be used to access PHP pseudo_hash values indexed either by string or integer value.

The PHP entity can be either an array, represented by PHP::ArrayHandle, or an object, represented by PHP::Object. In the latter case, the object properties are represented as hash/array values.

PHP::Entity->link($original, $link)

Records a reference to an arbitrary perl scalar $link as an alias to $original PHP::Entity object. This is used internally by PHP::TieHash and PHP::TieArray, but might be also used for other purposes.

Contains set of internal options. If called without parameters, returns the names of the options. If called with a single parameter, return the associated value. If called with two parameters, replaces the associated value.

debug $integer

If set, loads of debugging information are dumped to stderr

Default: 0

stdout/stderr $callback

stdout and stderr options define callbacks that are called when PHP decides to print something or complain, respectively.

Default: undef

header $callback

Callback when PHP sets a response header with the PHP header() function. The callback will receive two arguments, corresponding to the first two arguments of the PHP header() function.

Default: undef

version

Read-only option; returns the version of PHP library compiled with .

PHP::set_php_input($string)

Sets content for PHP applications that read from the <php://input stream.

PHP::_spoof_rfc1867($filename)

Manipulates an internal hash in PHP so that PHP's is_uploaded_file function will return true for the given filename. This can be helpful when you have already manipulated PHP's global $_FILES variable for an application that uploads files. But it is not always necessary.

DEBUGGING

Environment variable P5PHPDEBUG, if set to 1, turns the debug mode on. The same effect can be achieved programmatically by calling

PHP::options( debug => 1);

INSTALLATION

The module uses php-embed SAPI extension to inter-operate with PHP interpreter. That means php must be configured with '--enable-embed' parameters prior to using the module. Also, no '--with-apxs' must be present in to configuration agruments either, otherwise the PHP library will be linked with Apache functions, and will be unusable from the command line.

The sub dl_load_flags { 0x01 } code in PHP.pm is required for PHP to load correctly its extensions. If your platform does RTLD_GLOBAL by default and croaks upon this line, it is safe to remove the line.

WHY?

While I do agree that in general it is absolutely pointless to use PHP functionality from within Perl, scenarios where one must connect an existing PHP codebase to something else, are not something unusual. Also, this module might be handy for people who know PHP but are afraid of switching to Perl, or want to reuse their old PHP code.

Currently, not all of PHP functionality is implemented, but OTOH I don't really expect this module to grow that big, because I believe it is easier to call PHP::eval rather than implement all the subtleties of Zend API. There are no callbacks to Perl from PHP code, and I don't think these are needed, because one thing is to be lazy and not to rewrite PHP code, and another is to make new code in PHP that uses Perl when PHP is not enough. As I see it, the latter would kill all incentive to switch to Perl, so I'd rather leave callbacks unimplemented.

As a valued partner and proud supporter of MetaCPAN, StickerYou is
happy to offer a 10% discount on all Custom Stickers,
Business Labels, Roll Labels,
Vinyl Lettering or Custom Decals. StickerYou.com
is your one-stop shop to make your business stick.
Use code METACPAN10 at checkout to apply your discount.