PHP counter disappears/reappears

1

I downloaded a script to run a very basic counter on two of my website's pages. Since April 2009 it's run beautifully, but in the last three weeks it would suddenly disappear, then reappear occasionally. This week it's every day.At first the counter just disappeared, now the pages with the counters don't load except the banner. The page will load eventually, up to five minutes sometimes. But without the counter showing. That comes ages later. Then it can all disappear again!

[http://www.thepenvro.com/][1] is the home page Then if you click on "NEWS", then on "Social Events News" that's the other page that has a counter. (We are trying to see who is interested in the reunion info). The pages are erratic. They will either be OK, or they are there but missing the counter in the lower left of each the two page, or the pages will only show the headers with no page content OR counter. All in no particular order.

I have gone into the server side of my site and reset the scripting (was told to do that by the Streamline.net tekkie). It doesn't seem to help but now and then and wonder if it's just coincidence.

It affects another script. I have a form to email that works great, but when this counter disappears, it brings down the form to email function on the Contacts page. I put a note at the bottom of the form for visitors to just send an email when they get the error message. The full error message when you can manage to get SUBMIT to even change screens is:

FastCGI Error
The FastCGI Handler was unable to process the request. 
Error Details:
The FastCGI pool queue is full 
Error Number: 4 (0x80070004). 
Error Description: The system cannot open the file. 
HTTP Error 500 - Server Error.
Internet Information Services (IIS)

Streamline asks me to replicate the error...I can't! I can only give them what I am posting here and screenshots. So I don't have a clue if it's my script or them. The script for the counter is below. It was something I purchased as well. I first thought maybe it was IE8 that was causing the trouble, but the same problem shows in Firefox.

One last note....It's not the form to email that's a problem as I have that also running in one of the sub-domain's of the site and there is NO trouble there. But I do not have the counter running anywhere on the sub-domain either. I have all the same features for the main and sub-domain.

Thank you for any help...I am a complete novice so any solutions will be gratefully received. We are doing the publicity for our reunion in May and I have a big email campaign after Christmas to get out and I don't want the site all buggered up. If there is an alternative counter or if the version's php I have is too old, I am happy to purchase a better one from a reputable source.

<?php
/*******************************************************************************
*  Title: PHP hit counter (PHPcount)
*  Version: 1.2 @ October 26, 2007
*  Author: Klemen Stirn
*  Website: http://www.phpjunkyard.com
********************************************************************************
*  COPYRIGHT NOTICE
*  Copyright 2004-2007 Klemen Stirn. All Rights Reserved.

*******************************************************************************/

// SETUP YOUR COUNTER
// Detailed information found in the readme.htm file

// Count UNIQUE visitors ONLY? 1 = YES, 0 = NO
$count_unique = 1;
// Number of hours a visitor is considered as "unique"
$unique_hours = 1;
// Minimum number of digits shown (zero-padding). Set to 0 to disable.
$min_digits = 0;

#############################
#     DO NOT EDIT BELOW     #
#############################

/* Turn error notices off */
error_reporting(E_ALL ^ E_NOTICE);

/* Get page and log file names */
$page = input($_GET['page']) or die('ERROR: Missing page ID');
$logfile = 'logs/' . $page . '.txt';

   /* Does the log exist? */
   if (file_exists($logfile)) {

    /* Get current count */
    $count = trim(file_get_contents($logfile)) or $count = 0;

    if ($count_unique==0 || $_COOKIE['counter_unique']!=$page) {
    /* Increase the count by 1 */
    $count = $count + 1;
    $fp = @fopen($logfile,'w+') or die('ERROR: Can\'t write to the log file 
   ('.$logfile.'), please make sure this file exists and is CHMOD to 666 (rw-rw-rw-)!');
    flock($fp, LOCK_EX);
    fputs($fp, $count);
    flock($fp, LOCK_UN);
    fclose($fp);

    /* Print the Cookie and P3P compact privacy policy */
    header('P3P: CP="NOI NID"');
    setcookie('counter_unique', $page, time()+60*60*$unique_hours);
}

/* Is zero-padding enabled? */
if ($min_digits > 0) {
    $count = sprintf('%0'.$min_digits.'s',$count);
}

/* Print out Javascript code and exit */
echo 'document.write(\''.$count.'\');';
exit();

} else {
die('ERROR: Invalid log file!');
}

/* This functin handles input parameters making sure nothing dangerous is passed in */
function input($in) {
$out = htmlentities(stripslashes($in));
$out = str_replace(array('/','\\'), '', $out);
return $out;
}
?>
javascript
counter
hit
asked on Stack Overflow Dec 13, 2009 by Lauren • edited Jan 10, 2012 by (unknown user)

3 Answers

2

This has nothing to do with the PHP code, but with the configuration of the webserver. It probably gets hit too many times per second to be able to process all requests.

Try looking at the following settings from IIS:

  • instanceMaxRequests
  • maxInstances
  • queueLength
answered on Stack Overflow Dec 13, 2009 by TomHastjarjanto
1

If you visit the counter directly you can see this error message:

<h1>FastCGI Error</h1> 
The FastCGI Handler was unable to process the request. 
<hr> 
<p>Error Details:</p> 
<ul> 
<li>The FastCGI pool queue is full</li>
<li>Error Number: 4 (0x80070004).</li> 

<li>Error Description: The system cannot open the file.
</li> 

</ul> 
<h2>HTTP Error 500 - Server Error.<br>Internet Information Services (IIS)</h2>

I'd say it's either what Tomh says, it gets too many hits so while one request is reading from the file another one tries to open it and it fails, OR it simply cannot open it because of a permission problem.

answered on Stack Overflow Dec 13, 2009 by vrutberg
0

A lot of people have experienced the same problem while using streamline.net, myself included. I currently have a site with them that is down about 50% of the day, every day of the week with that error.

My recommendation, change to a new provider.

Streamline.net won't do a thing to help you and will meerly fob you off with vague / innacurate answers. I'm just waiting for my next paycheque then I'm going to buy hosting with someone else.

answered on Stack Overflow Mar 1, 2010 by Matt Sawyer

User contributions licensed under CC BY-SA 3.0