Support » Plugin: WP-Piwik » WP-Piwik error 403 trying to connect to Piwik

  • Tomas Risberg

    (@tomasrisbergsilentse)


    Hi,

    I have tried this problem in an other tread were Piwik was confused with WP Piwik, so I start this new one.

    My Piwik installation works fine, but my WP-Piwik isn’t well. WP Piwik doesn’t connect to Piwik. I have modified my htaccess. I have also tried without the htaccess at all. I have deactivated all my other WP plugins. I have asked my ISP about local host and the answer me that the MySql server is an other server than the one that is running my WordPress installation. My ISP encourages me to talk to the plugin author of WP-Piwik.

    I have Piwik installed in a folder in the same public_html as my WordPress installation. I am able to connect WordPress to other folders with index.php files in them, but WP-Piwik is rejected when trying to access Piwik.

    I have thought that running Piwik in the same public_html as WordPress is similar to running two WordPress-installations in the same public_html and I discovered this writing:

    http://www.dinelogik.com/mbstrategic/11/install-wordpress-as-subdirectory-of-another-wordpress-installation-two-wordpress-installations-one-domain/

    Should I or my ISP create a so called symbolic link between something in my WordPress installation and something in the Piwik installation, for making it possible fot WP-Piwik to connect to Piwik?

    This is my debug log:

    WP-Piwik 1.0.17
    Mode: http
    
    Test 1/3: global.getPiwikVersion
    
    bool(false)
    
    array(2) {
      [0]=>
      string(234) "HTTP/1.1 403 Forbidden
    Date: Thu, 21 Sep 2017 20:56:55 GMT
    Server: Apache
    Vary: accept-language,accept-charset
    Accept-Ranges: bytes
    Transfer-Encoding: chunked
    Content-Type: text/html; charset=iso-8859-1
    Content-Language: en
    
    "
      [1]=>
      string(149) "http://exp.silent.se/analytics/?module=API&method=API.getBulkRequest&format=json&urls[0]=method%3DAPI.getPiwikVersion%26idSite%3Dn%2Fa&token_auth=..."
    }
    
    Test 2/3: SitesManager.getSitesWithAtLeastViewAccess
    
    bool(false)
    
    array(2) {
      [0]=>
      string(234) "HTTP/1.1 403 Forbidden
    Date: Thu, 21 Sep 2017 20:56:55 GMT
    Server: Apache
    Vary: accept-language,accept-charset
    Accept-Ranges: bytes
    Transfer-Encoding: chunked
    Content-Type: text/html; charset=iso-8859-1
    Content-Language: en
    
    "
      [1]=>
      string(226) "http://exp.silent.se/analytics/?module=API&method=API.getBulkRequest&format=json&urls[0]=method%3DAPI.getPiwikVersion%26idSite%3Dn%2Fa&urls[1]=method%3DSitesManager.getSitesWithAtLeastViewAccess%26idSite%3Dn%2Fa&token_auth=..."
    }
    
    Test 3/3: SitesManager.getSitesIdFromSiteUrl
    
    bool(false)
    
    array(2) {
      [0]=>
      string(234) "HTTP/1.1 403 Forbidden
    Date: Thu, 21 Sep 2017 20:56:55 GMT
    Server: Apache
    Vary: accept-language,accept-charset
    Accept-Ranges: bytes
    Transfer-Encoding: chunked
    Content-Type: text/html; charset=iso-8859-1
    Content-Language: en
    
    "
      [1]=>
      string(330) "http://exp.silent.se/analytics/?module=API&method=API.getBulkRequest&format=json&urls[0]=method%3DAPI.getPiwikVersion%26idSite%3Dn%2Fa&urls[1]=method%3DSitesManager.getSitesWithAtLeastViewAccess%26idSite%3Dn%2Fa&urls[2]=method%3DSitesManager.getSitesIdFromSiteUrl%26idSite%3Dn%2Fa%26url%3Dhttp%3A%2F%2Fexp.silent.se&token_auth=..."
    }
    
    array(2) {
      ["global_settings"]=>
      array(63) {
        ["revision"]=>
        string(10) "2017080901"
        ["last_settings_update"]=>
        string(10) "1506027402"
        ["piwik_mode"]=>
        string(4) "http"
        ["piwik_url"]=>
        string(31) "http://exp.silent.se/analytics/"
        ["piwik_path"]=>
        string(40) "http://exp.silent.se/analytics/index.php"
        ["piwik_user"]=>
        string(0) ""
        ["piwik_token"]=>
        string(3) "set"
        ["auto_site_config"]=>
        string(1) "1"
        ["default_date"]=>
        string(9) "yesterday"
        ["stats_seo"]=>
        string(1) "0"
        ["dashboard_widget"]=>
        string(8) "disabled"
        ["dashboard_chart"]=>
        string(1) "0"
        ["dashboard_seo"]=>
        string(1) "0"
        ["toolbar"]=>
        string(1) "0"
        ["capability_read_stats"]=>
        array(5) {
          ["administrator"]=>
          string(1) "1"
          ["editor"]=>
          string(1) "0"
          ["author"]=>
          string(1) "0"
          ["contributor"]=>
          string(1) "0"
          ["subscriber"]=>
          string(1) "0"
        }
        ["perpost_stats"]=>
        string(1) "0"
        ["plugin_display_name"]=>
        string(8) "WP-Piwik"
        ["piwik_shortcut"]=>
        string(1) "0"
        ["shortcodes"]=>
        string(1) "0"
        ["track_mode"]=>
        string(8) "disabled"
        ["track_codeposition"]=>
        string(6) "footer"
        ["track_noscript"]=>
        string(1) "0"
        ["track_nojavascript"]=>
        string(1) "0"
        ["proxy_url"]=>
        string(0) ""
        ["track_content"]=>
        string(8) "disabled"
        ["track_search"]=>
        string(1) "0"
        ["track_404"]=>
        string(1) "0"
        ["add_post_annotations"]=>
        array(0) {
        }
        ["add_customvars_box"]=>
        string(1) "0"
        ["add_download_extensions"]=>
        string(0) ""
        ["set_download_extensions"]=>
        string(0) ""
        ["set_link_classes"]=>
        string(0) ""
        ["set_download_classes"]=>
        string(0) ""
        ["disable_cookies"]=>
        string(1) "0"
        ["limit_cookies"]=>
        string(1) "0"
        ["limit_cookies_visitor"]=>
        string(8) "34186669"
        ["limit_cookies_session"]=>
        string(4) "1800"
        ["limit_cookies_referral"]=>
        string(8) "15778463"
        ["track_admin"]=>
        string(1) "0"
        ["capability_stealth"]=>
        array(0) {
        }
        ["track_across"]=>
        string(1) "0"
        ["track_across_alias"]=>
        string(1) "0"
        ["track_crossdomain_linking"]=>
        string(1) "0"
        ["track_feed"]=>
        string(1) "0"
        ["track_feed_addcampaign"]=>
        string(1) "0"
        ["track_feed_campaign"]=>
        string(4) "feed"
        ["track_heartbeat"]=>
        string(1) "0"
        ["track_user_id"]=>
        string(8) "disabled"
        ["cache"]=>
        string(1) "1"
        ["http_connection"]=>
        string(4) "curl"
        ["http_method"]=>
        string(4) "post"
        ["disable_timelimit"]=>
        string(1) "0"
        ["connection_timeout"]=>
        string(1) "5"
        ["disable_ssl_verify"]=>
        string(1) "0"
        ["disable_ssl_verify_host"]=>
        string(1) "0"
        ["piwik_useragent"]=>
        string(3) "php"
        ["piwik_useragent_string"]=>
        string(8) "WP-Piwik"
        ["dnsprefetch"]=>
        string(1) "0"
        ["track_datacfasync"]=>
        string(1) "0"
        ["track_cdnurl"]=>
        string(0) ""
        ["track_cdnurlssl"]=>
        string(0) ""
        ["force_protocol"]=>
        string(8) "disabled"
        ["update_notice"]=>
        string(7) "enabled"
      }
      ["settings"]=>
      array(6) {
        ["name"]=>
        string(0) ""
        ["site_id"]=>
        string(3) "n/a"
        ["noscript_code"]=>
        string(0) ""
        ["tracking_code"]=>
        string(0) ""
        ["last_tracking_code_update"]=>
        string(1) "0"
        ["dashboard_revision"]=>
        string(1) "0"
      }
    }
    

    I would appreciate any help in how to solve this problem
    Tomas Risberg

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author braekling

    (@braekling)

    Hi Tomas,

    fist, please don’t spread your issue over several threads… this is just confusing and does not help to solve your problem.

    There is no reason not to install Piwik in a subdirectory of your WordPress folder (in your case ./analytics) as long as there is no conflict with your mod_rewrite rules etc. Because it is possible to open your Piwik dashboard, there is no conflict, so everything is ok.

    The reason why WP-Piwik is not able to connect to Piwik is shown in the test script’s output:

    HTTP/1.1 403 Forbidden

    What does this mean? See WP-Piwik’s FAQ:

    bool(false) and HTTP/1.1 403 Forbidden: WP-Piwik is not allowed to connect to Piwik. Please check your Piwik server’s configuration. Maybe you are using a password protection via .htaccess or you are blocking requests from localhost/127.0.0.1. If you aren’t sure about this, please contact your web hoster for support.

    It’s hard to say more without deeper knowledge about your system or a crystal ball. WP-Piwik tries to send a HTTP request to Piwik, but your server answers “Forbidden”, you are not allowed to access me. As said in the FAQ there is some reason in your server configuration why your server does not accept this connection.

    If your ISP is not willing to support, maybe your server’s log files (e.g. access.log and error.log) may give a hint what’s happening here.

    It’s also worth a try to use the PHP API, so WP-Piwik can connect by including the Piwik libraries instead of connecting via HTTP.

    Tomas Risberg

    (@tomasrisbergsilentse)

    Thanks for trying to help.

    I have alo tried the PHP API option for WP-Piwik to access to Piwik, but with no difference. I also changed my complicated .htaccess for a less complicated one and let one hour pass so that any server cache would be emptied, but with no success.

    I have tried to understand my server logs. I can see traces of WP-Piwik but with no obvious error.

    Tomas

    Tomas Risberg

    (@tomasrisbergsilentse)

    Excuse me. Sent the message twice.

    • This reply was modified 2 months, 3 weeks ago by  Tomas Risberg.
    Tomas Risberg

    (@tomasrisbergsilentse)

    Further examining I now see errors related to WP-Piwik in the php-error.log

    One of the warnings starts with: Backtrace from warning ‘Invalid argument supplied for foreach()

    An other with ‘array_reverse() expects parameter 1 to be array, null given’

    Tomas

    Plugin Author braekling

    (@braekling)

    These errors are caused by empty data, but are not related to the 403 error. You should not look for WP-Piwik related log entries, you should check why access to Piwik is denied. WP-Piwik can’t change anything as long as it gets a “Forbidden” response.

    Using the PHP API a 403 does not make sense. So what does not difference mean there? Are you sure you configured the correct path to Piwik? Here debugging and the log files should give clear hints if WP-Piwik is not able to load the Piwik files directly (not found, safe mode restrictions, etc.).

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.