[phpOpenTracker-User] Windows to Unix (FreeBSD) migration problems: "Warning: session_register(): Cannot send session cookie/cache limiter - headers already sent by.."

"Jimisola Laursen" <[email protected]> Sun, 21 Mar 2004 19:47:45 +0100
Newsgroups gmane.comp.web.phpopentracker.general
Message-ID <012d01c40f74$fff58540$fa01000a@knuth>
Hi!

I just upgraded from POT 1.0.x to 1.4.1 (yes, I was way behind). The upgrade
went quite smooth.
There was however, some stuff missing the
docs/sql/mysql/update/1_1_X_to_1_2_0.sql script which I dealt with manually.

The upgrade was done on Windows:

Windows NT 5.0 build 2195
Microsoft-IIS/5.0
PHP Version 4.3.1
MySQL 3.23.49

After everything ran smooth I then tried to move my whole web site (document
root) to FreeBSD:

FreeBSD 4.8-RELEASE-p13 FreeBSD 4.8-RELEASE-p13 #0: Sun i386 PHP Version 4.3.4
Apache/1.3.29 (Unix) PHP/4.3.4
MySQL 3.23.58
PHP Version 4.3.4


However, now I keep getting the following error messages (which I did not have
under Windows):

Warning: session_register(): Cannot send session cookie - headers already sent
by (output started at /home/iismine.com/public_html/index.php:2) in
/home/iismine.com/public_html/phpOpenTracker/Container.php on line 66

Warning: session_register(): Cannot send session cache limiter - headers already
sent (output started at /home/iismine.com/public_html/index.php:2) in
/home/iismine.com/public_html/phpOpenTracker/Container.php on line 66


I invoke POT in my index.php as seen below:

index.php:
    // phpOpenTracker
    require_once 'phpOpenTracker.php';
    // log access
    phpOpenTracker::log(
      array('document' => "$include_page",
        'client_id' => 0)
    );


My config file is attached as phpOpenTracker.php.

I followed the error message from

Container.php:65-68:
---
    if ($init && !$initAPI) {
      session_register('_phpOpenTracker_Container');
      $container = &$_SESSION['_phpOpenTracker_Container'];
    }
---

to

LoggingEngine.php:66-70:

---
  function phpOpenTracker_LoggingEngine($parameters = array()) {
    $parameters['init'] = true;

    $this->config    = &phpOpenTracker_Config::getConfig();
    $this->container = &phpOpenTracker_Container::getInstance($parameters);
---

If is change "$parameters['init'] = true;" to "$parameters['init'] = false;"
(i.e. to false), then the error message is gone!

But, does not seem to be the right solution. Any help would be appreciated.

While at it I have a, hopefully, easier problem as well: does POT have any
support for NOT loggin hits from certain ips or hosts?
The setting below can't be used for this in some fasion or can it?

// With this directive you can turn on or off the locking of
// certain IPs and/or user agents.
// $PHPOPENTRACKER_CONFIGURATION['locking'] = false;


Kind regards,
Jimisola
phpOpenTracker.php (application/octet-stream, 6.7 KB)
<?php
//
// phpOpenTracker - The Website Traffic and Visitor Analysis Solution
//
// Copyright 2000 - 2004 Sebastian Bergmann. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// $Id: phpOpenTracker.php.dist,v 1.3.2.1.2.3 2004/03/12 14:53:42 bergmann Exp $
//
//

$PHPOPENTRACKER_CONFIGURATION = &phpOpenTracker_Config::getConfig();

/**
* phpOpenTracker Configuration File
*
* This file contains global configuration settings for phpOpenTracker.
* Values may be safely edited by hand.
* Uncomment only values that you intend to change.
*
* Strings should be enclosed in 'quotes'.
* Integers should be given literally (without quotes).
* Boolean values may be true or false (never quotes).
*/

// Database Type
// Available values: 'mssql', 'mysql', 'oci8', 'pgsql'
$PHPOPENTRACKER_CONFIGURATION['db_type'] = 'mysql';

// The host of your database server
$PHPOPENTRACKER_CONFIGURATION['db_host'] = 'somemysqlhost';

// The port your database server listens on
$PHPOPENTRACKER_CONFIGURATION['db_port'] = 'default';

// The socket your database server uses
$PHPOPENTRACKER_CONFIGURATION['db_socket'] = 'default';

// Username to connect with to your database server
$PHPOPENTRACKER_CONFIGURATION['db_user'] = 'someuser';

// Password to connect with to your database server
$PHPOPENTRACKER_CONFIGURATION['db_password'] = 'somepwd';

// Name of the database to use.
$PHPOPENTRACKER_CONFIGURATION['db_database'] = 'somedb';

// Name of the Additional Data Table
// Default: 'pot_add_data'
$PHPOPENTRACKER_CONFIGURATION['additional_data_table'] = 'pot_add_data';

// Name of the Access Log Table
// Default: 'pot_accesslog'
$PHPOPENTRACKER_CONFIGURATION['accesslog_table'] = 'pot_accesslog';

// Name of the Documents Table
// Default: 'pot_documents'
$PHPOPENTRACKER_CONFIGURATION['documents_table'] = 'pot_documents';

// Name of the Exit Targets Table
// Default: 'pot_exit_targets'
$PHPOPENTRACKER_CONFIGURATION['exit_targets_table'] = 'pot_exit_targets';

// Name of the Hostnames Table
// Default: 'pot_hostnames'
$PHPOPENTRACKER_CONFIGURATION['hostnames_table'] = 'pot_hostnames';

// Name of the Operating Systems Table
// Default: 'pot_operating_systems'
$PHPOPENTRACKER_CONFIGURATION['operating_systems_table'] = 'pot_operating_systems';

// Name of the Referers Table
// Default: 'pot_referers'
$PHPOPENTRACKER_CONFIGURATION['referers_table'] = 'pot_referers';

// Name of the User Agents Table
// Default: 'pot_user_agents'
$PHPOPENTRACKER_CONFIGURATION['user_agents_table'] = 'pot_user_agents';

// Name of the Visitors Table
// Default: 'pot_visitors'
$PHPOPENTRACKER_CONFIGURATION['visitors_table'] = 'pot_visitors';

// 
$PHPOPENTRACKER_CONFIGURATION['delay_key_write'] = false;

// Name of the environment variable to be used to 
// determine the current document.
// For instance, 'PATH_INFO' or 'REQUEST_URI' are possible here.
$PHPOPENTRACKER_CONFIGURATION['document_env_var'] = 'REQUEST_URI';

// When enabled, phpOpenTracker will strip away all HTTP GET
// parameters from the referer's URL before it gets stored
// in the database.
$PHPOPENTRACKER_CONFIGURATION['clean_referer_string'] = true;

// When enabled, phpOpenTracker will strip away all HTTP GET
// parameters from the URL, before it gets stored in the
// database.
// A Session ID will be stripped from the URL in either case.
$PHPOPENTRACKER_CONFIGURATION['clean_query_string'] = false;

// While enabling clean_query_string to will clean the
// document's URL of any HTTP GET parameters, you can define
// with the get_parameter_filter array a list of HTTP GET
// parameters that you would like to be stripped from the URL.
$PHPOPENTRACKER_CONFIGURATION['get_parameter_filter'] = '';

// Resolving of the hostname can be turned off.
$PHPOPENTRACKER_CONFIGURATION['resolve_hostname'] = true;

// Grouping of hostnames can be turned off.
$PHPOPENTRACKER_CONFIGURATION['group_hostnames'] = true;

// Grouping and parsing of user agents can be turned off.
$PHPOPENTRACKER_CONFIGURATION['group_user_agents'] = true;

// Detect and log returning visitors.
$PHPOPENTRACKER_CONFIGURATION['track_returning_visitors'] = true;

// Name of the cookie to use for returning visitors detection.
$PHPOPENTRACKER_CONFIGURATION['returning_visitors_cookie'] = 'pot_visitor_id';

// The 'returning_visitors_cookie' cookie expires after
// 'returning_visitors_cookie_lifetime' days.
$PHPOPENTRACKER_CONFIGURATION['returning_visitors_cookie_lifetime'] = 365;

// With this directive you can turn on or off the locking of
// certain IPs and/or user agents.
// $PHPOPENTRACKER_CONFIGURATION['locking'] = false;

// With this directive you can turn on or off the logging of
// reloaded documents.
$PHPOPENTRACKER_CONFIGURATION['log_reload'] = false;

// The path to your JPGraph installation.
// $PHPOPENTRACKER_CONFIGURATION['jpgraph_path'] = '';

// With this directive you can define the names, separated by commas,
// of plugins for the phpOpenTracker Logging Engine, that should be
// loaded.
// $PHPOPENTRACKER_CONFIGURATION['logging_engine_plugins'] = '';

// When enabled, the result of a phpOpenTracker API query which is
// limited to a timerange that lies completely in the past will be
// stored in a cache.
$PHPOPENTRACKER_CONFIGURATION['query_cache'] = false;

// The directory where the phpOpenTracker API Query Cache should
// store its files.
$PHPOPENTRACKER_CONFIGURATION['query_cache_dir'] = 'C:\\WINNT\\TEMP';

// The lifetime of a phpOpenTracker API Query Cache entry in seconds.
$PHPOPENTRACKER_CONFIGURATION['query_cache_lifetime'] = 3600;

// 0: Don't output error and warning messages.
// 1: Output error and warning messages. (default)
// 2: Output additional debugging messages.
$PHPOPENTRACKER_CONFIGURATION['debug_level'] = 1;

// When enabled, phpOpenTracker will exit on fatal errors.
$PHPOPENTRACKER_CONFIGURATION['exit_on_fatal_errors'] = false;

// When enabled, phpOpenTracker will log debugging, error and warning
// messages to a logfile.
$PHPOPENTRACKER_CONFIGURATION['log_errors'] = true;

// Mapping of client ids to client names.
// Currently only used by the simple_report example application.
$PHPOPENTRACKER_CONFIGURATION['clients'][0] = 'domain0';
$PHPOPENTRACKER_CONFIGURATION['clients'][1] = 'domain1';

//
// "phpOpenTracker essenya, gul meletya;
//  Sebastian carneron PHP."
//
?>