Recipe 21.11 Communicating Between mod_perl and PHP
You want to build your site from both mod_perl and PHP. For example, you might want to use mod_perl for authentication and logging, while PHP generates the actual content. However, doing so means that Perl and PHP must share values; for example, so the PHP content handler knows which username successfully authenticated through mod_perl.
Use Apache notes. From Perl, you simply say:
$main = $r->main || $r; $main->notes($KEY => $VALUE); $VALUE = $main->notes($KEY);
From PHP, you say:
apache_note($KEY, $VALUE); $VALUE = apache_note($KEY);
A note is a string value attached to an Apache request. They're a perfect way to pass information between handlers, even when those handlers are written in different programming languages. Each request has a different set of notes, so from Perl always identify the main request and use it to communicate with PHP code.
Don't confuse the $r->notes method with the $r->pnotes method. The latter is only available to Perl modules.
21.11.4 See Also