Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

htaccess error: Invalid command 'Deny', perhaps misspelled or defined by a module not included in the server configuration #4941

Closed
anonymous-matomo-user opened this issue Apr 2, 2014 · 12 comments
Labels
Bug For errors / faults / flaws / inconsistencies etc. worksforme The issue cannot be reproduced and things work as intended.

Comments

@anonymous-matomo-user
Copy link

I am installing Piwik 2.1.0. My servers error log file is getting a bunch of errors. When I go to the starting url the page loads only text with no formatting and the following errors are written to my log. I have attached a screen shot of the Piwik page showing the problem. Am I doing something incorrect in my installation or is there a bug in the Piwik code?

= Notes

  1. All url's referenced for my installation are running on an intranet and therefore will not be accessible. Also I have changed urls, paths, and ip addresses for security just in case.
  2. I have ssh and sudo access to the server that I am installing Piwik on.

= Error Log Output

I truncated the actual log output because it wouldnt let me submit the ticket with that many urls since it thought it was spam.

[Wed Apr 02 13:42:15.511040 2014] [core:alert] [pid 26061:tid 139842377684736] [client 111.111.111.111:64185] /xxx/xxx/analytics/libs/.htaccess: Invalid command 'Deny', perhaps misspelled or defined by a module not included in the server configuration, referer: http://xxx.com/analytics/
[Wed Apr 02 13:42:15.511055 2014] [core:alert] [pid 26061:tid 139842472093440] [client 111.111.111.111:64184] /xxx/xxx/analytics/plugins/.htaccess: Invalid command 'Deny', perhaps misspelled or defined by a module not included in the server configuration, referer: http://xxx.com/analytics/

= Installation Procedure

  1. cd to install directory
  2. wget http://builds.piwik.org/latest.zip
  3. unzip latest.zip

= Server Configuration

OS: RHEL 6.4
PHP: 5.5.10
Apache: 2.4.7
MySQL Client: 5.0.11
Loaded Modules:


core mod_so http_core event mod_unixd mod_authz_core mod_authz_host mod_auth_basic 
mod_authn_file mod_auth_digest mod_include mod_log_config mod_env mod_mime_magic 
mod_cern_meta mod_expires mod_deflate mod_headers mod_usertrack mod_unique_id 
mod_setenvif mod_mime mod_dav mod_status mod_autoindex mod_asis mod_info 
mod_dav_fs mod_vhost_alias mod_negotiation mod_dir mod_imagemap mod_actions 
mod_speling mod_userdir mod_alias mod_rewrite mod_proxy mod_proxy_ftp
mod_proxy_http mod_proxy_connect mod_cgi mod_php5 mod_passenger

= My Fix

The errors are complaining about modules not being included. From research it seems that the "Deny", "Allow", and "Satisfy" commands in the htaccess file in the <IfModule mod_authz_host.c> blocks are deprecated in apache 2.4.

In the piwik/libs/.htaccess file and the piwik/plugins/.htaccess file I changed

<IfModule mod_authz_host.c>
Deny from all
</IfModule>

to

<IfModule mod_authz_host.c>
Require all denied
</IfModule>

and I changed

<IfModule mod_authz_host.c>
Allow from all
</IfModule>

to

<IfModule mod_authz_host.c>
Require all  granted
</IfModule>

and I changed

Satisfy any

to

<IfModule mod_authz_host.c>
Satisfy any
</IfModule>

After changing these files I set the permissions to read only for user, group, and other. Now when I run the application it works ok and there are no errors in my log file.

@anonymous-matomo-user
Copy link
Author

Attachment: Screenshot
Screen Shot 2014-04-02 at 1.49.37 PM.png

@anonymous-matomo-user
Copy link
Author

I apologize. I made a typo. I changed

Satisfy any

to

<IfModule !mod_authz_host.c>
Satisfy any
</IfModule>

@mattab
Copy link
Member

mattab commented Apr 6, 2014

Thanks for the report, if it's a quick fix we should definitely do it!

@mattab
Copy link
Member

mattab commented Apr 8, 2014

In ae54752: Updated .htaccess refs #4941
Can you please test the latest Piwik beta and confirm whether it still bugs as you describe?

@anonymous-matomo-user
Copy link
Author

Matt where is the latest beta? Is it just the master branch on Github?

@mattab
Copy link
Member

mattab commented Apr 8, 2014

master branch is OK, otherwise see: http://piwik.org/faq/how-to-update/faq_159/

@gaumondp
Copy link

gaumondp commented Apr 9, 2014

Link to all versions is http://builds.piwik.org/

Matt I plan to update manually from 1.12 to latest beta (piwik-2.2.0-b18.tar.gz at the moment).

Anything not written somewhere I should know about ?

Got 6 GB DB to update and yes, I read http://piwik.org/docs/update/#the-manual-three-step-update

Dali

@anonymous-matomo-user
Copy link
Author

Matt,

I've downloaded the new beta and tried it out and I'm still getting the same errors. The documentation for upgrading from Apache 2.2. to 2.4 is here: http://httpd.apache.org/docs/2.4/upgrading.html.

I'm pretty sure you cannot have both Allow/Deny and Require in the same block because if the user is using 2.4 then the Allow/Deny will continue to cause a failure. Additionally I believe Satisfy is deprecated in Apache 2.2.

I've gone through the .htaccess file and tried reconfiguring it to handle these changes. This syntax is working for me but I dont know if I could it is 100% compatible with pre 2.4 apache versions because I have no way of testing this.

<Files ~ "\.(php|php4|php5|inc|tpl|in|twig)$">
  <IfModule mod_access.c>
    Deny from all
  </IfModule>
  <IfModule !mod_access_compat>
    <IfModule mod_authz_host.c>
      Require all denied
    </IfModule>
  </IfModule>
  <IfModule mod_access_compat>
    Deny from all
  </IfModule>
</Files>
<Files ~ "\.(test\.php|gif|ico|jpg|png|svg|js|css|swf)$">
  <IfModule !mod_access_compat>
    <IfModule mod_authz_host.c>
      Require all granted
    </IfModule>
  </IfModule>
  <IfModule mod_access.c>
    Allow from all
  </IfModule>
  <IfModule mod_access_compat>
    Allow from all
  </IfModule>
</Files>

@mattab
Copy link
Member

mattab commented May 14, 2014

See related/possibly same issue #4499

@mattab
Copy link
Member

mattab commented May 14, 2014

In 6e83e22: Refs #4499 #4941 Adding <IfModule !mod_authz_host.c> around the Satisfy any which may fix the issue.

To test run the following command in the piwik directory:

rm js/.htaccess plugins/.htaccess core/.htaccess libs/.htaccess vendor/.htaccess misc/user/.htaccess

(this deletes all current htaccess files)

Then visit the System check page
(this re-creates the .htaccess files)

Then browse Piwik -> is it working fine?

If not, check your error log and please paste error as a comment in the ticket.

@anonymous-matomo-user anonymous-matomo-user added this to the 2.5.0 - Piwik 2.5.0 milestone Jul 8, 2014
sabl0r pushed a commit to sabl0r/piwik that referenced this issue Sep 23, 2014
….c> around the Satisfy any which may fix the issue.

To test run the following command in the piwik directory:
```
rm js/.htaccess plugins/.htaccess core/.htaccess libs/.htaccess vendor/.htaccess  misc/user/.htaccess
```
(this deletes all current htaccess files)

Then visit the System check page
(this re-creates the .htaccess files)

Then browse Piwik -> is it working fine?

If not, check your error log and please paste error as a comment in the ticket.
@mattab
Copy link
Member

mattab commented Dec 1, 2014

Not reported since improvements made in https://github.com/piwik/piwik/blob/master/plugins/Installation/ServerFilesGenerator.php, works

@mattab mattab closed this as completed Dec 1, 2014
@mattab mattab added the worksforme The issue cannot be reproduced and things work as intended. label Dec 1, 2014
@AsadullahFarooqi
Copy link

AsadullahFarooqi commented Jan 21, 2018

hey guys i have the same issue but with my django app so what should i do please help
this is the code of .htaccess file

---------------------------------------------------------------------------------------------------------
# DO NOT REMOVE. CLOUDLINUX PASSENGER CONFIGURATION BEGIN
PassengerAppRoot "/home/dasawork/store"
PassengerBaseURI "/test"
PassengerPython "/home/dasawork/virtualenv/store/3.5/bin/python3.5"
# DO NOT REMOVE. CLOUDLINUX PASSENGER CONFIGURATION END
----------------------------------------------------------------------------------------------------------

it worked at night first and then in the morning it wasn't working and giving the error "/home/dasawork/public_html/test/.htaccess: Invalid command 'PassengerAppRoot', perhaps misspelled or defined by a module not included in the server configuration". hosting providers changed my root dir name! like when it worked it was "'/newhome/dasawork/...." but on the morning it was changed to "/home/dasawork/..." so can this cause the problem ?
please help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc. worksforme The issue cannot be reproduced and things work as intended.
Projects
None yet
Development

No branches or pull requests

4 participants