@anonymous-matomo-user opened this Issue on April 2nd 2014

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 commented on April 2nd 2014
@anonymous-matomo-user commented on April 2nd 2014

I apologize. I made a typo. I changed

Satisfy any

to

<IfModule !mod_authz_host.c>
Satisfy any
</IfModule>
@mattab commented on April 6th 2014 Member

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

@mattab commented on April 8th 2014 Member

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

@anonymous-matomo-user commented on April 8th 2014

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

@mattab commented on April 8th 2014 Member

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

@gaumondp commented on April 9th 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 commented on April 9th 2014

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 commented on May 14th 2014 Member

See related/possibly same issue #4499

@mattab commented on May 14th 2014 Member

In 6e83e2299b9fc9a876fda6d7576d88bca933c0ee: 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.
@mattab commented on December 1st 2014 Member
@AsadullahFarooqi commented on January 21st 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

This Issue was closed on December 1st 2014
Powered by GitHub Issue Mirror