mod_perl handler and PHP

mod_perl handler and PHP

am 17.03.2009 17:21:00 von Daniel.Angileri

This is a multipart message in MIME format.
--=_alternative 0059D069C125757C_=
Content-Type: text/plain; charset="US-ASCII"

Hello list,

is it possible to parse the output of mod_perl handler through PHP?

I tried like this:

### httpd.conf ###
PHPIniDir "C:/PHP/"
LoadModule php5_module "C:/PHP/php5apache2_2.dll"

### vhost.conf ###

SetHandler modperl
PerlHandler My::Handler
SetOutputFilter PHP



When I trie to call up /ls/app/demo/index.php the Apache serves me the
file for downloading.

Apache 2.2.6 (Win32)
PHP 5.2.9
mod_perl 2.0.3
Active Perl v. 5.8.8


Has anyone already set up this szenario?


Regards
Daniel
--=_alternative 0059D069C125757C_=
Content-Type: text/html; charset="US-ASCII"



Hello list,



is it possible to parse the output of
mod_perl handler through PHP?




I tried like this:



### httpd.conf ###

PHPIniDir "C:/PHP/"

LoadModule php5_module "C:/PHP/php5apache2_2.dll"



### vhost.conf ###

    <Location /ls/app/demo>

      SetHandler modperl

      PerlHandler My::Handler

      SetOutputFilter
PHP


    </Location>





When I trie to call up /ls/app/demo/index.php
the Apache serves me the file for downloading.




Apache 2.2.6 (Win32)

PHP 5.2.9

mod_perl 2.0.3

Active Perl v. 5.8.8





Has anyone already set up this szenario?





Regards

Daniel
--=_alternative 0059D069C125757C_=--

Re: mod_perl handler and PHP

am 17.03.2009 17:25:31 von Perrin Harkins

On Tue, Mar 17, 2009 at 12:21 PM, wrote:
> is it possible to parse the output of mod_perl handler through PHP?

No, mod_php is not tightly integrated with apache the way mod_perl is.
It doesn't allow you to write your own filters or handlers. The best
you can do is make a perl output filter that runs the PHP code.

- Perrin

Re: mod_perl handler and PHP

am 17.03.2009 17:33:48 von mcapone

This is a multi-part message in MIME format.
--------------000003010200090908060107
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Perhaps something like this might work?

in index.php:

$phpcode =
file_get_contents("http://127.0.0.1/path/to/perl/module/that /outputs/php/code.pl");
eval($phpcode);

Obviously, you'd have to take care with the php syntax that was output
from code.pl, but that might give you the functionality you're looking
for. We've done similar things where perl was better suited to a
particular task on a page that otherwise wanted PHP.

Daniel.Angileri@imperia.net wrote:
>
> Hello list,
>
> is it possible to parse the output of mod_perl handler through PHP?
>
> I tried like this:
>
> ### httpd.conf ###
> PHPIniDir "C:/PHP/"
> LoadModule php5_module "C:/PHP/php5apache2_2.dll"
>
> ### vhost.conf ###
>
> SetHandler modperl
> PerlHandler My::Handler
> SetOutputFilter PHP
>

>
>
> When I trie to call up /ls/app/demo/index.php the Apache serves me the
> file for downloading.
>
> Apache 2.2.6 (Win32)
> PHP 5.2.9
> mod_perl 2.0.3
> Active Perl v. 5.8.8
>
>
> Has anyone already set up this szenario?
>
>
> Regards
> Daniel

--------------000003010200090908060107
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit







Perhaps something like this might work?



in index.php:



   $phpcode =
file_get_contents();

   eval($phpcode);



Obviously, you'd have to take care with the php syntax that was output
from code.pl, but that might give you the functionality you're looking
for.  We've done similar things where perl was better suited to a
particular task on a page that otherwise wanted PHP.



wrote:
cite="mid:OF50720040.EBEBDAF2-ONC125757C.0059C58C-C125757C.0 059D07A@imperia.net"
type="cite">

Hello list,




is it possible to parse the output
of
mod_perl handler through PHP?





I tried like this:




### httpd.conf ###


PHPIniDir "C:/PHP/"


LoadModule php5_module
"C:/PHP/php5apache2_2.dll"





### vhost.conf ###


    <Location /ls/app/demo>


      SetHandler modperl


      PerlHandler My::Handler


      SetOutputFilter
PHP



    </Location>






When I trie to call up
/ls/app/demo/index.php
the Apache serves me the file for downloading.





Apache 2.2.6 (Win32)


PHP 5.2.9


mod_perl 2.0.3


Active Perl v. 5.8.8






Has anyone already set up this
szenario?







Regards


Daniel




--------------000003010200090908060107--

Re: mod_perl handler and PHP

am 17.03.2009 18:25:54 von david

On Mar 17, 2009, at 9:21 AM, Daniel.Angileri@imperia.net wrote:

> is it possible to parse the output of mod_perl handler through PHP?

You can if you write a perl filter that uses PHP::Interpreter to
execute some code that parses your mod_perl output.

Best,

David

Re: mod_perl handler and PHP

am 18.03.2009 10:33:15 von Daniel.Angileri

This is a multipart message in MIME format.
--=_alternative 00347BCAC125757D_=
Content-Type: text/plain; charset="US-ASCII"

> No, mod_php is not tightly integrated with apache the way mod_perl is.
> It doesn't allow you to write your own filters or handlers. The best
> you can do is make a perl output filter that runs the PHP code.


OK, thank you for the fast answer.
I will try ;)

Daniel
--=_alternative 00347BCAC125757D_=
Content-Type: text/html; charset="US-ASCII"



> No, mod_php is not tightly integrated
with apache the way mod_perl is.

>  It doesn't allow you to write your own filters or handlers.
 The best

> you can do is make a perl output filter that runs the PHP code.






OK, thank you for the fast answer.

I will try ;)



Daniel
--=_alternative 00347BCAC125757D_=--

Re: mod_perl handler and PHP

am 19.03.2009 15:38:14 von Daniel.Angileri

This is a multipart message in MIME format.
--=_alternative 0050679DC125757E_=
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset="ISO-8859-1"

Hello,

I found a way to parse the output of mod=5Fperl through PHP with debian=20
linux.


PHP has to be compiled with "apxs2filter":
----------------------------------
"apt-get install apache2-threaded-dev"
for apxs2

download latest php

..configure --with-apxs2filter=3D/usr/bin/apxs2
make

attention: you run in trouble using an empty httpd.conf. You can fill it=20
like this:

# This is here for backwards compatability reasons and to support
# installing 3rd party modules directly via apxs2, rather than
# through the /etc/apache2/mods-{available,enabled} mechanism.
#
#LoadModule mod=5Fplaceholder /usr/lib/apache2/modules/mod=5Fplaceholder.so


make install
mkdir -p /etc/php5/apache2
cp php.ini-dist /etc/php5/apache2/php.ini


For debian
strip --strip-debug /usr/lib/apache2/modules/libphp5.so
strip --strip-unneeded /usr/lib/apache2/modules/libphp5.so

ln -s /etc/apache2/mods-available/php5.load=20
/etc/apache2/mods-enabled/php5.load
ln -s /etc/apache2/mods-available/php5.conf=20
/etc/apache2/mods-enabled/php5.conf

make clean
----------------------------------



Apache
----------------------------------
- apache module "mod=5Ffilter" has to be enabled

vhost.conf:


SetHandler modperl
PerlHandler My::Handler
FilterProvider PHPFILTER PHP resp=3DPHPFILTER "*"
FilterTrace PHPFILTER 0
FilterChain PHPFILTER

----------------------------------



Has someone done this for windows? Or does someone know where I get php=20
with apxs2filter for windows?


Bye
Daniel

p.s.: helpful link (german)=20
http://self-qs.de/m3WDB/Php=5F5.2.1=5Ffür=5FApache=5F2.2.3 =5Fauf=5Fdebian
--=_alternative 0050679DC125757E_=
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset="ISO-8859-1"



Hello,



I found a way to parse the output of
mod=5Fperl through PHP with debian linux.






PHP has to be compiled with "ap=
xs2filter":


---------------------------------- font>

"apt-get install apache2-thread=
ed-dev"


for apxs2



download latest php



.configure --with-apxs2filter=3D/usr=
/bin/apxs2


make



attention: you run in trouble using
an empty httpd.conf. You can fill it like this:




# This is here for backwards comp=
atability
reasons and to support


#  installing 3rd party modules directly via apxs2, rather than=


#  through the /etc/apache2/mods-{available,enabled} mechanism.=


#

#LoadModule mod=5Fplaceholder /usr/lib/apache2/modules/mod=5Fplaceholder=
..so






make install

mkdir -p /etc/php5/apache2

cp php.ini-dist /etc/php5/apache2/php.ini






For debian

strip --strip-debug /usr/lib/apache2=
/modules/libphp5.so

strip --strip-unneeded /usr/lib/apache2/modules/libphp5.so




ln -s /etc/apache2/mods-available/ph=
p5.load
/etc/apache2/mods-enabled/php5.load

ln -s /etc/apache2/mods-available/php5.conf /etc/apache2/mods-enabled/php5.=
conf




make clean

---------------------------------- font>







Apache

---------------------------------- font>

- apache module "mod=5Ffilter&q=
uot;
has to be enabled




vhost.conf:



    <Location /ls/app/d=
emo>


        SetHandl=
er
modperl


        PerlHand=
ler
My::Handler


        FilterPr=
ovider
PHPFILTER PHP resp=3DPHPFILTER "*"


        FilterTr=
ace
PHPFILTER 0


        FilterCh=
ain
PHPFILTER


    </Location> t>

---------------------------------- font>







Has someone done this for windows? Or
does someone know where I get php with apxs2filter for windows?






Bye

Daniel



p.s.: helpful link (german) http://s=
elf-qs.de/m3WDB/Php=5F5.2.1=5Ffür=5FApache=5F2.2.3=5Fauf=5 Fdebian

--=_alternative 0050679DC125757E_=--

Re: mod_perl handler and PHP

am 21.03.2009 19:19:56 von Issac Goldstand

Daniel.Angileri@imperia.net wrote:
>
> Hello,
>
> I found a way to parse the output of mod_perl through PHP with debian
> linux.
>
>
> PHP has to be compiled with "apxs2filter":
> ----------------------------------
> "apt-get install apache2-threaded-dev"
> for apxs2
>
> download latest php
>
> .configure --with-apxs2filter=/usr/bin/apxs2
> make
>
> attention: you run in trouble using an empty httpd.conf. You can fill it
> like this:
>
> /# This is here for backwards compatability reasons and to support/
> /# installing 3rd party modules directly via apxs2, rather than/
> /# through the /etc/apache2/mods-{available,enabled} mechanism./
> /#/
> /#LoadModule mod_placeholder /usr/lib/apache2/modules/mod_placeholder.so/
>
>
> make install
> mkdir -p /etc/php5/apache2
> cp php.ini-dist /etc/php5/apache2/php.ini
>
>
> For debian
> strip --strip-debug /usr/lib/apache2/modules/libphp5.so
> strip --strip-unneeded /usr/lib/apache2/modules/libphp5.so
>
> ln -s /etc/apache2/mods-available/php5.load
> /etc/apache2/mods-enabled/php5.load
> ln -s /etc/apache2/mods-available/php5.conf
> /etc/apache2/mods-enabled/php5.conf
>
> make clean
> ----------------------------------
>
>
>
> Apache
> ----------------------------------
> - apache module "mod_filter" has to be enabled
>
> vhost.conf:
>
>
> SetHandler modperl
> PerlHandler My::Handler
> FilterProvider PHPFILTER PHP resp=PHPFILTER "*"
> FilterTrace PHPFILTER 0
> FilterChain PHPFILTER
>

> ----------------------------------
>
>
>
> Has someone done this for windows? Or does someone know where I get php
> with apxs2filter for windows?
>
>

Just use the php5apache2_filter.dll module instead of php5apache2.dll
and you're set to go

Issac