WordPress.org

Support

Support » Plugins and Hacks » [Resolved] [Plugin: WP SlimStat] No footer js served on Debian installation = no humans

[Resolved] [Plugin: WP SlimStat] No footer js served on Debian installation = no humans

  • I’ve been trying to work out why I have no human visitors on my website.
    The problem is that the javascript is not loaded up in the footer. I tried to load the wp-slimstat-js.php file directly but the page gave an error ‘Error parsing wp-config’

    Further checking found that DB_PASSWORD is not found in the parsed_config and therefore the check on line 48 fails. I had a look at all of the other plug-ins including the rest of wp-slimstat and none of them directly query the database; they all use the wpdb object.

    The direct access to the database fails, which is why the javascript doesn’t get served up. I’m not sure what the fix is for this though. This happened with a Debian install, but it could happen with others as well.

    http://wordpress.org/extend/plugins/wp-slimstat/

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Jason Crouse

    @coolmann

    Have you moved your wp-content folder from its default location? Also, if the JS is not loaded, it’s not related to wp-slimstat-js.php. That file is invoked AFTER the page has been served, by the javascript.

    Is your cache subfolder writable and a file cache.php present in it?

    Camu

    OK, there are two separate problems.

    The first is when I test from home I don’t get the script. The reason is that I’m running IPv6 and the ip2long tests all fail. That’s a reasonably simple explanation and its why I was not seeing the script. A couple of echos around the relevant parts of the code clearly show that is what is going on there.

    The second problem is other times the js script gets loaded and then it goes to GET wp-slimstat-js.php and we get the database problem. I can see in the apache logs those sorts of accesses but if I go there directly even with the right query string the database error occurs.

    Plugin Author Jason Crouse

    @coolmann

    Thank you for the additional information. The problem with IPV6 will be solved in one of the next releases, I’m already working on it.

    As for the DB error, it still says that the password cannot be found? Is wp-config.php in the root folder and wp-slimstat-js.php in wp-content/plugins/wp-slimstat?

    Camu

    OK, I got the fix for this. The problem is Debian installations don’t use wp-config, but /etc/wordpress/config-<site>.php

    I’m not sure how this can be handled without breaking other sites, but if you are running the Debian wordpress packages, edit line 15 of wp-slimstat-js.php from:
    $wp_config = file_get_contents($wp_root_folder.'/wp-config.php');

    to look like:

    $debian_server = preg_replace('/:.*/', "", $_SERVER['HTTP_HOST']);
    $debian_server = preg_replace("/[^a-zA-Z0-9.\-]/", "", $debian_server);
    $debian_file = '/etc/wordpress/config-'.strtolower($debian_server).'.php';
    /* Main site in case of multisite with subdomains */
    $debian_main_server = preg_replace("/^[^.]*\./", "", $debian_server);
    $debian_main_file = '/etc/wordpress/config-'.strtolower($debian_main_server).'.php';
    if (file_exists($debian_file)) {
            $wp_config = file_get_contents($debian_file);
    } elseif (file_exists($debian_main_file)) {
            $wp_config = file_get_contents($debian_main_file);
    } else
            die("Cannot open config file");

    Plugin Author Jason Crouse

    @coolmann

    Yes, what you did is technically correct, but I guess it’s easier to just edit the line of that file (third line or so) where it says

    $wp_root_folder = '../../..';

    specifying the relative or fully absolute (from the real server root folder) path of the folder where wp-config.php is located. Of course Debian has always to be different, who knows why. That’s why I’ll always be a Fedora fan 😀

    Cheers,
    Camu

    Plugin Author Jason Crouse

    @coolmann

    PS: A vote for my plugin would be a nice way to thank me for my support/efforts.

    Camu

    Will do once I work out the voting thingy. The Debian changes permit you to be a multi-site easily; unless you directly read the config file of course.

    Now that the js script works I can see all the data!!

    Plugin Author Jason Crouse

    @coolmann

    Voting is really easy (maybe too easy). Just go here

    http://wordpress.org/extend/plugins/wp-slimstat/

    and click on the number of stars you believe this plugin is worth 🙂 Then same thing to tell other people if it works or not. Just click on the appropriate button and you’re done.

    Looking forward to your vote!
    Camu

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Resolved] [Plugin: WP SlimStat] No footer js served on Debian installation = no humans’ is closed to new replies.