You are here: Foswiki>Tasks Web>Item12896 (05 Jul 2015, GeorgeClark)Edit Attach

Item12896: pub suggested htaccess file php_flag

pencil
Priority: Normal
Current State: Closed
Released In: 2.0.0
Target Release: major
Applies To: Engine
Component:
Branches: trunk
Reported By: VickiBrown
Waiting For:
Last Change By: GeorgeClark
The pub-htaccess.txt file contains this code
# If you have PHP4 or PHP5 installed as Apache module make sure the directive below is enabled
# If you do not have PHP installed you will need to comment out the directory below
# to avoid errors.
# If PHP is installed as CGI this flag is not needed and will in fact make Apache fail 
php_flag engine off

1. I am guessing that the word directory in the second comment line should be directive

2. Given that the people most likely to be working with .htaccess files are using a hosted web site I suggest that this line:
php_flag engine off

should be commented out as distributed.

There are two different ways this directive can fail, it's more likely to fail on a hosted site where security restrictions are tighter , and a user with a restricted site will have a more difficult time finding the error log entry that explains why it failed.

-- VickiBrown - 09 May 2014

I can't find the reference now, but I'd expect a better general solution would be to use the <IfModule directive so that the statement isn't active if PHP is not installed. There would need to be different IfModule directives to cover the various versions of PHP. Ah... found an example:

    <ifmodule mod_php3.c>
        php3_engine off
    </ifmodule>
    <ifmodule mod_php4.c>
        php_admin_flag engine off
    </ifmodule>
    <ifmodule mod_php5.c>
        php_admin_flag engine off
    </ifmodule>

-- GeorgeClark - 09 May 2014

Vicki, Do you know if the above syntax would survive on the hosting sites you've used? If sow, we can update this for 1.2

-- GeorgeClark - 29 May 2014

According to the searching I just did, IfModule has existed since at least Apache 1.3, so that shouldn't be an issue. It's supposed to work in .htaccess if Allowoverride ALL is set (which is should be for these sites because that's how they allow all of the config to be done from .htaccess).

I don't know of any reasons why it shouldn't work... (but I'm not an Apache expert.)

-- VickiBrown - 29 May 2014

Changes checked in and given a quick test. I don't have old versions of php available, but apache was happy. Waiting for Release.

-- GeorgeClark - 29 May 2014
 

ItemTemplate edit

Summary pub suggested htaccess file php_flag
ReportedBy VickiBrown
Codebase 1.1.9, trunk
SVN Range
AppliesTo Engine
Component
Priority Normal
CurrentState Closed
WaitingFor
Checkins distro:b7c597def9f2
TargetRelease major
ReleasedIn 2.0.0
CheckinsOnBranches trunk
trunkCheckins distro:b7c597def9f2
Release01x01Checkins
Topic revision: r7 - 05 Jul 2015, GeorgeClark - This page was cached on 28 Jun 2016 - 22:38.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License