PDA

View Full Version : cannot redeclare mysql_errors



sonicwood
01-05-2006, 04:10 AM
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

Patrick
01-05-2006, 12:46 PM
The problem has to do with the way the script current handles errors. To fix the problem:

Open counter.php and find:

include($OPTION['Absolute_Path']."counter-error.php");

And REPLACE it with:

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 ):

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).

sonicwood
01-05-2006, 11:28 PM
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?

Patrick
01-06-2006, 12:11 AM
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.