October 30, 2003

AWSTATS automatic updating script

I am using Awstats for web stats on this server, but was annoyed with having to place changes in my /etc/cron.daily/logrotate file in order to get updating working automagically. I wrote a quick little script to handle it, which locates and runs all the updates for all awstats.domain.conf files in the /etc directory.

Here is the script:

    #!/bin/bash
    for WEBSITE in `ls /etc/awstats*conf | sed "s/^.etc.awstats.//" | sed "s/.conf$//"`; do
    /var/www/cgi-bin/awstats.pl -update -config=$WEBSITE
    done;

In RedHat or similar, just place this line in your /etc/cron.daily/logrotate file just before the call to the logrotate script, like so:

    #!/bin/sh
    /usr/local/bin/awupdate
    /usr/sbin/logrotate /etc/logrotate.conf

Posted by Enki at 12:06 PM | Comments (0) | TrackBack

October 27, 2003

Stupid Spam Posts

I am getting just a little tired of receiving spam posts in my movable type blog. These little fuckers post Viagra ads. On My Blog!!!!

Are they trying to tell me something?

Maybe they are telling me to implement MT-Blacklist. I was going to make a script that detected the spam when I got the notifications, but a plug-in for Movable Type seems so much cleaner.

Posted by Enki at 08:04 AM | Comments (0) | TrackBack

June 12, 2003

Cthuugle

There may be some people who are unaware that my domain is an offshoot form the Cthuugle search engine. Cthuugle is a search engine optimized to find H.P. Lovecraft related materials on the web. I made it as a joke some time ago, and kept it because of continuing demand.

Anyway, I added a link to this page in order to drive hits up. Me==bad.

Posted by Enki at 11:13 AM | Comments (0) | TrackBack

February 21, 2003

PHPBB Fix, And Google Loves Me? They Really Really Love Me?

I was pleased to discover that my site was of help to somebody having trouble with the PHP/Apache/PHPBB bug that I mentioned earlier...

    A google search turned up your Space Meat page about apache 2 and php 4.
    I've been fighting that problem for a week. Yeah for fixed! Thank you for posting that complexity. Hope apache and php learn to play nice in the future!

    Peace,
    Lynn Dobbs
    Ngender Consulting Group
Of course what really gets me is the fact that my site shows up before any other fixes on google even though there are better sources available with more comprehensive searches.

Posted by Enki at 02:55 PM | Comments (0)

November 20, 2002

Bugs in PHP 4.2.2 / APACHE 2.0.40

Found some new bugs in RedHat Linux 8.0 today, with a couple of workarounds. Here is the deal. Let us suppose that you install RedHat 8.0 and have some PHP scripts you are running... "BAD" idea.
Stick with RedHat 7.3. The problem is that 8.0 comes with Apache 2, which does not play nice with PHP yet. It is in fact still considered beta. The first bug I have run into is that cache control is whacky, exacerbated by what is reportedly an inconsistency in the way IE caches pages. My biggest problem was with PhpBB, since the codebase is fairly large. Here is the solution as brought to me by the nice people on the phpBB support board...

    I'm not running RH8, but RH7.1.
    I'm running Apache 2.0.39 and PHP 4.2.2, but I'm sure that it will work on later versions.

    I've had the same ridiculous problem with the browser-caching, I've solved it by adding some META TAGS to my overall_header and overall_footer HTML files in my style's template. (Yes, META TAGS in overall_footer too!)

    First, I've commented the three header() function calls that you can find in the phpbb file, located at [phpbb directory]/includes/page_header.php, near the end of the file, starting at the line number 449:

    header ('Cache-Control: private, pre-check=0, post-check=0, max-age=0');
    header ('Expires: ' . gmdate('D, d M Y H:i:s', time()) . ' GMT');
    header ('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');

    Comment them, so they look as follows:
    // header ('Cache-Control: private, pre-check=0, post-check=0, max-age=0');
    // header ('Expires: ' . gmdate('D, d M Y H:i:s', time()) . ' GMT');
    // header ('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');

    You can also just delete those three lines.
    Those lines puts a header in the html connection wich is sent to the user, due to the fact that those headers are included as POST data, they have more priority than conventional META TAGS. (I think is for that reason, not sure)

    So, now we don't have any cache-control information with the pages that are sent to our phpbb users. To ensure that the pages will be always reloaded, and not taken from the cache, I've added the conventional META TAGS to my overall_header.tpl file, located in [phpbb directory]/templates/[theme name]/

    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="Expires" content="-1">
    Remember that those metas have to be inserted inside the head ... /head tags. Also, I've read somewhere that some versions of IE browsers have a bug in their cache control, and the solution is to put one meta in other head ... /head section, located at the end of the HTML page.

    To do this, I've inserted the following lines in the file overall_footer.tpl, located in the same place as the header:

    <head>
    <meta http-equiv="PRAGMA" content="NO-CACHE">
    </head>
    Remember to insert those three lines outside the body ... /body tag, but inside the html ... /html tag, si it looks as follows:

    ------------------
    (... whatever HTML your overall_footer.tpl has ...)

    </body>
    <head;>
    <meta http-equiv="PRAGMA" content="NO-CACHE">
    </head>
    </html>
    ------------------ It worked fine for me, and without using the "touch" trick.
    Hope it works good for you too.
Posted by Enki at 02:55 PM | Comments (0)