RT, Apache and PHP

I’m running the RT 2.0.11

I have installed PHP4 on the server that is running my company’s RT
instance, but I’m having trouble getting Apache to parse .php files.
When I comment the following out of my httpd.conf, everything works
fine:

PerlModule Apache::DBI
PerlFreshRestart On
PerlRequire /opt/rt2/bin/webmux.pl

SetHandler perl-script
PerlHandler RT::Mason

When I put it back in, I get asked to download the .php file instead of
parsing it. Can anyone tell me what exactly the code above does and/or
if there is a way around this?

Thank you in advance

Bolivar

Bolivar Geraldo (Junior)
NOC Analyst
E-mail: bgeraldo@sockeye.com

Check your httpd.conf and make sure the line “AddType
application/x-httpd-php .php” isn’t commented out…

It kinda sounds like PHP didn’t install completely/correctly?

Greg Smythe
SysAdmin
Intellstat Communications
WA State Resident-----Original Message-----
From: Bolivar Geraldo [mailto:bgeraldo@sockeye.com]
Sent: Friday, February 08, 2002 4:49 PM
To: rt-users@lists.fsck.com
Subject: [rt-users] RT, Apache and PHP

I’m running the RT 2.0.11

I have installed PHP4 on the server that is running my company’s RT
instance, but I’m having trouble getting Apache to parse .php files.
When I comment the following out of my httpd.conf, everything works
fine:

PerlModule Apache::DBI
PerlFreshRestart On
PerlRequire /opt/rt2/bin/webmux.pl

SetHandler perl-script
PerlHandler RT::Mason

When I put it back in, I get asked to download the .php file instead of
parsing it. Can anyone tell me what exactly the code above does and/or
if there is a way around this?

Thank you in advance

Bolivar

Bolivar Geraldo (Junior)
NOC Analyst
E-mail: bgeraldo@sockeye.com

Hi Bolivar!

I don’t know wether I am right but I think I can explain you problem. If you
use

SetHandler perl-script PerlHandler RT::Mason

Apache will handle all requests coming to that specific location by using a
perl-script (which in this case is RT::Mason).

As all your php-scripts reside in the / Location which is mentioned in the
directive above Apache tries to handle those scripts with the PerlHandler as
well, which is the reason why they don’t get parsed as expected.

Try a setup like the third mentioned in

http://fsck.com/rtfm/article.html?id=2#100

where under the Location /rt2 the must not be php scripts.

Please forgive me my bad englisch and if I explained something wrong, but
that is how I understand the problem.

Please let me know wether I could help you with this eMail.

Regards,

Benjamin Boksa

I’m running the RT 2.0.11

I have installed PHP4 on the server that is running my company’s RT
instance, but I’m having trouble getting Apache to parse .php files.
When I comment the following out of my httpd.conf, everything works
fine:

PerlModule Apache::DBI
PerlFreshRestart On
PerlRequire /opt/rt2/bin/webmux.pl

SetHandler perl-script
PerlHandler RT::Mason

When I put it back in, I get asked to download the .php file instead of
parsing it. Can anyone tell me what exactly the code above does and/or
if there is a way around this?

Thank you in advance

Bolivar

Benjamin Boksa
b.boksa@sidebysite.de

side by site GmbH & Co. KG
Druckgestaltung & Webdesign

Barbarastr. 3-9 (Block 6)
D-50735 Koeln

Telefon: +49 221 2790964
Telefax: +49 221 2790965

I’m running the RT 2.0.11

I have installed PHP4 on the server that is running my company’s RT
instance, but I’m having trouble getting Apache to parse .php files.
When I comment the following out of my httpd.conf, everything works
fine:

PerlModule Apache::DBI
PerlFreshRestart On
PerlRequire /opt/rt2/bin/webmux.pl

SetHandler perl-script
PerlHandler RT::Mason

When I put it back in, I get asked to download the .php file instead of
parsing it. Can anyone tell me what exactly the code above does and/or
if there is a way around this?

That block says to use the handler perl-script for
everything under “/”. Probably not what you want, but I’m not sure
where the PHP-related stuff might reside to tell you how to fix it.

-Rich

Rich Lafferty --------------±----------------------------------------------
Ottawa, Ontario, Canada | Save the Pacific Northwest Tree Octopus!
http://www.lafferty.ca/ | Save The Pacific Northwest Tree Octopus
rich@lafferty.ca -----------±----------------------------------------------

Bolivar Geraldo bgeraldo@sockeye.com said something to this effect on 02/08/2002:

When I put it back in, I get asked to download the .php file
instead of parsing it. Can anyone tell me what exactly the code
above does and/or if there is a way around this?

Modify webmux.pl to decline to handle .php files, like so:

return DECLINED if $r->uri =~ /.phps?$/;

Add it right after the call to RT::Init().

As an aside, I have a fundamental problem with HTML::Mason's assumptions that it will be handling *everything*; a better approach that the nonsense would be the approach (or whatever your Mason-handled components are named), so that you don't run into these issues. One of the first lines of every HTML::Mason handler method is *always* "return DECLINED unless $i_want_to_handle_this_type", which defeats the whole purpose of Apache's TypeChecking phase.

(darren)

Don’t be ashamed to say what you are not ashamed to think.

Check your httpd.conf and make sure the line “AddType
application/x-httpd-php .php” isn’t commented out…

Greg Smythe
SysAdmin
Intellstat Communications
WA State Resident-----Original Message-----
From: Rich Lafferty [mailto:rich@lafferty.ca]
Sent: Friday, February 08, 2002 8:30 PM
To: rt-users@lists.fsck.com
Subject: Re: [rt-users] RT, Apache and PHP

On Fri, Feb 08, 2002 at 07:48:30PM -0500, Bolivar Geraldo (bgeraldo@sockeye.com) wrote:

I’m running the RT 2.0.11

I have installed PHP4 on the server that is running my company’s RT
instance, but I’m having trouble getting Apache to parse .php files.
When I comment the following out of my httpd.conf, everything works
fine:

PerlModule Apache::DBI
PerlFreshRestart On
PerlRequire /opt/rt2/bin/webmux.pl

SetHandler perl-script
PerlHandler RT::Mason

When I put it back in, I get asked to download the .php file instead of
parsing it. Can anyone tell me what exactly the code above does and/or
if there is a way around this?

That block says to use the handler perl-script for
everything under “/”. Probably not what you want, but I’m not sure
where the PHP-related stuff might reside to tell you how to fix it.

-Rich

Rich Lafferty --------------±----------------------------------------------
Ottawa, Ontario, Canada | Save the Pacific Northwest Tree Octopus!
http://www.lafferty.ca/ | Save The Pacific Northwest Tree Octopus
rich@lafferty.ca -----------±----------------------------------------------

rt-users mailing list
rt-users@lists.fsck.com
http://lists.fsck.com/mailman/listinfo/rt-users

Actually, if you change the “SetHandler” line to :

AddHandler perl-script .html

That will fix the problem. It will only make Mason handle html files,
not PHP files.

Does anyone know of anything else this breaks? Maybe it should be like
this in the docs and the README?

Matt

Rich Lafferty writes:>On Fri, Feb 08, 2002 at 07:48:30PM -0500, Bolivar Geraldo (bgeraldo@sockeye.co m) wrote:

I’m running the RT 2.0.11

I have installed PHP4 on the server that is running my company’s RT
instance, but I’m having trouble getting Apache to parse .php files.
When I comment the following out of my httpd.conf, everything works
fine:

PerlModule Apache::DBI
PerlFreshRestart On
PerlRequire /opt/rt2/bin/webmux.pl

SetHandler perl-script
PerlHandler RT::Mason

When I put it back in, I get asked to download the .php file instead of
parsing it. Can anyone tell me what exactly the code above does and/or
if there is a way around this?

That block says to use the handler perl-script for
everything under “/”. Probably not what you want, but I’m not sure
where the PHP-related stuff might reside to tell you how to fix it.

-Rich


Rich Lafferty --------------±----------------------------------------------
Ottawa, Ontario, Canada | Save the Pacific Northwest Tree Octopus!
http://www.lafferty.ca/ | Save The Pacific Northwest Tree Octopus
rich@lafferty.ca -----------±----------------------------------------------


rt-users mailing list
rt-users@lists.fsck.com
http://lists.fsck.com/mailman/listinfo/rt-users

I’m running the RT 2.0.11

I have installed PHP4 on the server that is running my company’s RT
instance, but I’m having trouble getting Apache to parse .php files.
When I comment the following out of my httpd.conf, everything works
fine:

PerlModule Apache::DBI
PerlFreshRestart On
PerlRequire /opt/rt2/bin/webmux.pl

SetHandler perl-script
PerlHandler RT::Mason

When I put it back in, I get asked to download the .php file instead of
parsing it. Can anyone tell me what exactly the code above does and/or
if there is a way around this?

That block says to use the handler perl-script for
everything under “/”. Probably not what you want, but I’m not sure
where the PHP-related stuff might reside to tell you how to fix it.

And there you have both the crux of, and the answer to the problem.
Simple answer is “Don’t mix HTML::Mason (RT) and PHP in the same tree.”

RT’s default installation docs assumes that RT is the only thing running
on that (virtual) server. It is quite possible to run it as
http://www.example.com/rt/’ instead of ‘http://www.example.com/’.

To do this, change the ‘Location’ to read:

<Location /rt/>

Change etc/config.pm:

$WebPath = "/rt";

( Note that WebURL is built up of $WebBaseURL . $WebPath . “/” )

Then, change your installation such that your RT’s WebRT directory matches
www.example.com/rt .

You will still have the problem of php files if they are beneath the RT
directory (which they should not be). You should not have the problem of
php files in other places in your hierarchy.

Regards,

                         Bruce Campbell                            RIPE
               Systems/Network Engineer                             NCC
             www.ripe.net - PGP562C8B1B                      Operations

Actually, if you change the “SetHandler” line to :

AddHandler perl-script .html

That will fix the problem. It will only make Mason handle html files,
not PHP files.

Does anyone know of anything else this breaks? Maybe it should be like
this in the docs and the README?

Yes, this breaks viewing attachments. I also recall something to do
with being able to view code of files within Elements, but that may be
unrelated.

I experimented with this some time ago, and I currently have:

AddHandler perl-script .html
PerlHandler RT::Mason
<Directory /path/to/WebRT/html/SelfService/Attachment/>
SetHandler perl-script

<Directory /path/to/WebRT/html/Ticket/Attachment/>
SetHandler perl-script

Unfortunately, I can’t remember all the reasons I decided this is
best. This configuration does avoid passing images/CSS through Mason,
reducing server load (slightly) and allowing proxy servers and
browsers to cache such elements and send “If-Modified-Since” requests
for them.

I think the only other issue I need to deal with is viewing code of
files within Elements, as mentioned above.

Tom