Defect #2021

Apache + PHP + modrails (Phusion Passenger)

Added by Celso Andrade almost 11 years ago. Updated almost 10 years ago.

Status:ClosedStart date:2008-10-10
Priority:LowDue date:
Assignee:-% Done:

0%

Category:SCM
Target version:-
Resolution:Invalid Affected version:

Description

I'm using Redmine(Svn checkout) for about six months now everthing works great but one thing is that i cant diff php file in repository browse.

When i try to do that i get a 404 page like that

Not Found

The requested URL /repositories/diff/commit/trunk/httpdocs/pedidoscliente.php was not found on this server.
Apache/2.2.8 (Ubuntu) DAV/2 SVN/1.4.6 PHP/5.2.4-2ubuntu5.3 with Suhosin-Patch mod_ruby/1.2.6 Ruby/1.8.6(2007-09-24) Phusion_Passenger/2.0.2 mod_perl/2.0.3 Perl/v5.8.8 Server at projetos.publiweb.com.br Port 80

My vhost apache config

<VirtualHost *>

   ServerName redmine
   DocumentRoot /srv/redmine/public

   SetEnv RAILS_ENV production
   <Directory "/srv/redmine/public">
     php_admin_flag engine off
     Options FollowSymLinks -ExecCGI
     AllowOverride All
     Order allow,deny
     Allow from all
   </Directory>
</VirtualHost>

my .htaccess

# General Apache options
<IfModule mod_fastcgi.c>
    AddHandler fastcgi-script .fcgi
</IfModule>
<IfModule mod_fcgid.c>
    AddHandler fcgid-script .fcgi
</IfModule>
<IfModule mod_cgi.c>
    AddHandler cgi-script .cgi
</IfModule>
Options +FollowSymLinks +ExecCGI
RewriteEngine On
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
<IfModule mod_fastcgi.c>
    RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
</IfModule>
<IfModule mod_fcgid.c>
    RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
</IfModule>
<IfModule mod_cgi.c>
    RewriteRule ^(.*)$ dispatch.cgi [QSA,L]
</IfModule>

ErrorDocument 500 "<h2>Application error</h2>Rails application failed to start properly" 

History

#1 Updated by Eric Davis almost 11 years ago

Celso Andrade wrote:

I'm using Redmine(Svn checkout) for about six months now everthing works great but one thing is that i cant diff php file in repository browse.

It's because Apache is seeing .php and trying to run the php intrepertuer on the file /repositories/diff/commit/trunk/httpdocs/pedidoscliente.php. Since that url isn't a real file, it gets a 404 error.

A solution that might work is to turn off mod_php for your Redmine virtual host. That will cause Apache to call Redmine to serve up the file, resulting in the diff.

#2 Updated by Jean-Philippe Lang almost 11 years ago

  • Status changed from New to Closed

Solution added to the FAQ. Thanks Eric.

#3 Updated by Nikos Dimitrakopoulos over 10 years ago

(for the stupid people like me)

Add the following to the vhost configuration to disable mod_php:

RemoveHandler .php

P.S.: Add this to the FAQ please - I lost about 15 mins trying to find out how to do it...

#4 Updated by Jean-Philippe Lang over 10 years ago

Done. Thanks.

#5 Updated by Aamer Abbas almost 10 years ago

  • Status changed from Closed to Reopened
  • Assignee set to Jean-Philippe Lang

The RemoveHandler thing didn't work on my Apache2 Ubuntu setup.

I had to also add this line in addition to RemoveHandler:
php_flag engine off

... I was considering updating the FAQ myself, but considering this is my first time contributing to this project, I didn't know if this is appropriate according to your rules :)

#6 Updated by Eric Davis almost 10 years ago

  • Status changed from Reopened to Closed
  • Assignee deleted (Jean-Philippe Lang)
  • Resolution set to Invalid

Aamer Abbas wrote:

... I was considering updating the FAQ myself, but considering this is my first time contributing to this project, I didn't know if this is appropriate according to your rules :)

I've added it but feel free to edit the FAQ page as needed.

Also available in: Atom PDF