+ Reply to Thread
Results 1 to 4 of 4

Thread: cannot redeclare mysql_errors

  1. Join Date
    Jan 2006
    Posts
    2

    cannot redeclare mysql_errors

    i've had quite a bit of difficulty getting your script to work

    as of today im using the latest versions of apache, php, mysql, and your script... on a windows machine

    I used to be getting:
    Undefined index: skip_config

    but i found on your forum to
    Find:
    CODE
    if (!$DB['skip_config'])


    and replace it with:
    CODE
    if (!isset($DB['skip_config']) || !$DB['skip_config'])



    but this error still resides:

    Fatal error: Cannot redeclare mysql_errors() (previously declared in C:\Program Files\Apache Group\Apache2\htdocs\ieee\counter\counter-error.php:12) in C:\Program Files\Apache Group\Apache2\htdocs\ieee\counter\counter-error.php on line 43


  2. Join Date
    Aug 2004
    Posts
    781

    Re: cannot redeclare mysql_errors

    The problem has to do with the way the script current handles errors. To fix the problem:

    Open counter.php and find:
    PHP Code:
    include($OPTION['Absolute_Path']."counter-error.php"); 
    And REPLACE it with:
    PHP Code:
    include_once($OPTION['Absolute_Path']."counter-error.php"); 
    The file was being included multiple times on multiple errors as the script was not being killed and therefore the function was being declared multiple times.

    Also, the easiest way to get rid of the notice errors is to properly set error reporting levels (as your default levels for all of PHP are too high). You can set them in the script by adding the following to the top of counter.php file (on the line below <?php ):
    PHP Code:
    error_reporting(E_ALL E_NOTICE); 
    The script is old but it still works well (and is easy) which is I guess why so many still use it. When I have time I plan to release a new version of it that is structurally better and completely rewrites the script itself (version 4.0).

  3. Join Date
    Jan 2006
    Posts
    2

    Re: cannot redeclare mysql_errors

    Wow I appreciate the extremely fast response.

    replacing with include_once($OPTION['Absolute_Path']."counter-error.php"); seemed to make the error go away...

    however, the page is now blank, the source is simply: <html><body></body></html>

    Im confused about what to do next. Any ideas?

  4. Join Date
    Aug 2004
    Posts
    781

    Re: cannot redeclare mysql_errors

    The lack of error reporting likely has to do with latest PHP version (like I said, this is an old script).

    However, I have been able to duplicate your results by not correctly specifying a mysql database name. Please open config_mysql.php and specify correct mysql database name, username, and password. The script will not create the mysql database, you have to do this on your own. If done correctly, the script will error and install the tables into the database automatically.

    If you do not have MySQL available, simply change the $DB['type'] setting in counter.php to 0, which will cause it to use files (default) instead of mysql.

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts