Guest Posted December 2, 2002 Share Posted December 2, 2002 After an install of PayPal IPN 096 for new checkout on a Nov 24 snapshot: Fatal error: Cannot redeclare tep_db_connect() (previously declared in /home/iceland2/public_html/admin/includes/functions/database.php:13) in /home/iceland2/public_html/admin/includes/functions/database.php on line 13 I have searched the forums for days on this, and only find other people with the same problem, but no reason for the error other than wrong DB info in configure.php. I cannot do anything in Admin, I can't get past this error. I have re-installed the mod 3 times, all admin, catalog and DB insertions are there. Please... someone.. anyone... after having problems with my Oct snapshot I have now installed a Nov snapshot, and am about ready to throw in the towel on this cart. I have checked my configure.php and everything looks fine - the following is the DB area of configure.php: // define our database connection define('DB_SERVER', 'localhost'); // eg, localhost - should not be NULL for productive servers define('DB_SERVER_USERNAME', 'yes_myusernameishere); define('DB_SERVER_PASSWORD', 'yes_mypasswordishere'); define('DB_DATABASE', 'iceland2_catalog'); define('USE_PCONNECT', 'false'); // use persisstent connections? define('STORE_SESSIONS', ''); // leave empty '' for default handler or set to 'mysql' Here is the database.php code: <?php /* $Id: database.php,v 1.21 2002/06/05 11:16:25 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2001 osCommerce Released under the GNU General Public License */ function tep_db_connect($server = DB_SERVER, $username = DB_SERVER_USERNAME, $password = DB_SERVER_PASSWORD, $database = DB_DATABASE, $link = 'db_link') { global $$link; if (USE_PCONNECT == 'true') { $$link = mysql_pconnect($server, $username, $password); } else { $$link = mysql_connect($server, $username, $password); } if ($$link) mysql_select_db($database); return $$link; } function tep_db_close($link = 'db_link') { global $$link; return mysql_close($$link); } function tep_db_error($query, $errno, $error) { die('<font color="#000000"><b>' . $errno . ' - ' . $error . '<br><br>' . $query . '<br><br><small><font color="#ff0000">[TEP STOP]</font></small><br><br></b></font>'); } function tep_db_query($query, $link = 'db_link') { global $$link, $logger; if (STORE_DB_TRANSACTIONS == 'true') { if (!is_object($logger)) $logger = new logger; $logger->write($query, 'QUERY'); } $result = mysql_query($query, $$link) or tep_db_error($query, mysql_errno(), mysql_error()); if (STORE_DB_TRANSACTIONS == 'true') { if (mysql_error()) $logger->write(mysql_error(), 'ERROR'); } return $result; } function tep_db_perform($table, $data, $action = 'insert', $parameters = '', $link = 'db_link') { reset($data); if ($action == 'insert') { $query = 'insert into ' . $table . ' ('; while (list($columns, ) = each($data)) { $query .= $columns . ', '; } $query = substr($query, 0, -2) . ') values ('; reset($data); while (list(, $value) = each($data)) { switch ((string)$value) { case 'now()': $query .= 'now(), '; break; case 'null': $query .= 'null, '; break; default: $query .= ''' . tep_db_input($value) . '', '; break; } } $query = substr($query, 0, -2) . ')'; } elseif ($action == 'update') { $query = 'update ' . $table . ' set '; while (list($columns, $value) = each($data)) { switch ((string)$value) { case 'now()': $query .= $columns . ' = now(), '; break; case 'null': $query .= $columns .= ' = null, '; break; default: $query .= $columns . ' = '' . tep_db_input($value) . '', '; break; } } $query = substr($query, 0, -2) . ' where ' . $parameters; } return tep_db_query($query, $link); } function tep_db_fetch_array($db_query) { return mysql_fetch_array($db_query, MYSQL_ASSOC); } function tep_db_result($result, $row, $field = '') { return mysql_result($result, $row, $field); } function tep_db_num_rows($db_query) { return mysql_num_rows($db_query); } function tep_db_data_seek($db_query, $row_number) { return mysql_data_seek($db_query, $row_number); } function tep_db_insert_id() { return mysql_insert_id(); } function tep_db_free_result($db_query) { return mysql_free_result($db_query); } function tep_db_fetch_fields($db_query) { return mysql_fetch_field($db_query); } function tep_db_output($string) { return stripslashes($string); } function tep_db_input($string) { return addslashes($string); } function tep_db_prepare_input($string) { if (is_string($string)) { return trim(stripslashes($string)); } elseif (is_array($string)) { reset($string); while (list($key, $value) = each($string)) { $string[$key] = tep_db_prepare_input($value); } return $string; } else { return $string; } } ?> For what its worth, I am on a shared Linux server, Kernel Version 2.4.19, Apache Version 1.3.27 (Unix), MySQL v3.23.53a , PHP MyAdmin v2.3.2 Violet Quote Link to comment Share on other sites More sharing options...
wasson65 Posted December 2, 2002 Share Posted December 2, 2002 PHP is complaining that the function is getting defined twice. This means that the "function tep_blahblahwhatever" is trying to get created again. Notice the both the files mentioned in the error are database.php So somehow database.php is getting invoked twice. Did the intallation of this mod include any changes to files adding code lines that used "include" or "require"? Quote Link to comment Share on other sites More sharing options...
Guest Posted December 2, 2002 Share Posted December 2, 2002 Hi Tim, and thanks so much for the reply. I am searching through the files that were changed, but so far the only 'require' or include' I can find is in admin -> includes: require(DIR_WS_BOXES . 'paypalipn.php'); // PAYPALIPN but nothing in languages. The only thing in languages is admin ->includes->languages->english->paypalipn_txn : */ define('HEADING_TITLE', 'Paypal IPN'); define('TABLE_HEADING_PAYPALIPN_TRANSACTIONS', 'TXN Id'); define('TABLE_HEADING_PAYPALIPN_AMOUNT', 'Amount'); define('TABLE_HEADING_PAYPALIPN_RESULT', 'Result'); define('TABLE_HEADING_PAYPALIPN_DATE', 'Date'); define('TABLE_HEADING_ACTION', 'Action'); define('TEXT_HEADING_VIEW_PAYPALIPN_TRANSACTIONS', 'Transaction Details'); define('TEXT_HEADING_DELETE_PAYPALIPN_TRANSACTIONS', 'Delete Transaction'); define('TEXT_DELETE_INTRO', 'Are you sure you want to delete this transaction?'); ?> I will keep looking in case I have missed a file with an include or require. Thanks, Violet Quote Link to comment Share on other sites More sharing options...
wasson65 Posted December 2, 2002 Share Posted December 2, 2002 Hi Tim, and thanks so much for the reply. I am searching through the files that were changed, but so far the only 'require' or include' I can find is in admin -> includes: require(DIR_WS_BOXES . 'paypalipn.php'); // PAYPALIPN but nothing in languages. The only thing in languages is admin ->includes->languages->english->paypalipn_txn : */ define('HEADING_TITLE', 'Paypal IPN'); define('TABLE_HEADING_PAYPALIPN_TRANSACTIONS', 'TXN Id'); define('TABLE_HEADING_PAYPALIPN_AMOUNT', 'Amount'); define('TABLE_HEADING_PAYPALIPN_RESULT', 'Result'); define('TABLE_HEADING_PAYPALIPN_DATE', 'Date'); define('TABLE_HEADING_ACTION', 'Action'); define('TEXT_HEADING_VIEW_PAYPALIPN_TRANSACTIONS', 'Transaction Details'); define('TEXT_HEADING_DELETE_PAYPALIPN_TRANSACTIONS', 'Delete Transaction'); define('TEXT_DELETE_INTRO', 'Are you sure you want to delete this transaction?'); ?> I will keep looking in case I have missed a file with an include or require. Thanks, Violet Can you get the basic installation to work without any mods at all? I'm trying to figure out if it's an OSC problem or the paypal mod problem. Tim Quote Link to comment Share on other sites More sharing options...
Guest Posted December 3, 2002 Share Posted December 3, 2002 Hi Tim, Yes, the snapshot/admin worked before putting the mod in. Thanks, Violet Quote Link to comment Share on other sites More sharing options...
wasson65 Posted December 3, 2002 Share Posted December 3, 2002 Hi Tim, Yes, the snapshot/admin worked before putting the mod in. Thanks, Violet Can you get it to work again by "removing" the mod, i.e. undoing whatever the mod did to install? If so, then look inside whatever files the mod adds, and see if it does any includes or requires. Tim Quote Link to comment Share on other sites More sharing options...
Guest Posted December 3, 2002 Share Posted December 3, 2002 Thanks Tim, I will go through all of the modified/added files. If I find something, should I just comment it out? Violet Quote Link to comment Share on other sites More sharing options...
wasson65 Posted December 3, 2002 Share Posted December 3, 2002 Thanks Tim, I will go through all of the modified/added files. If I find something, should I just comment it out? Violet First, look for a line that includes or requires database.php. If none of those exist, start checking the other included files. Look in the included file to see if that file includes or requires database.php. Something somewhere is including it again... Good luck! Quote Link to comment Share on other sites More sharing options...
Guest Posted December 3, 2002 Share Posted December 3, 2002 Hi Violet! In the PayPal IPN Mod, only application_top.php is included sometimes (yes, header, footer and some language files are also included, but they do not have any relation with the database functions, so we dont have to worry about them). The database.php file is included from the application_top.php, so you should also check out if there is not a repeated include of the application_top.php. Where do you get that error? I saw the problem is in your admin, but I dont know in which specific page it is failing. (maybe it is failing in all admin :( ) Best regards Quote Link to comment Share on other sites More sharing options...
Guest Posted December 3, 2002 Share Posted December 3, 2002 Hi guys, Ok, I downloaded the whole admin to my computer and did a search, and here is what I have found: - Only one application_top.php - In the PayPal mod, Paypalipn_txn, checkout_paypalipn.php, paypal_notify.php all call for application_top.php (could this be the second call for the database?) The error message comes when I go into the PayPal IPN area of Admin. I found as long as I stay out of that area, I can maneuver around the rest of admin. Is this what you are looking for? Thanks for all the help, Violet Quote Link to comment Share on other sites More sharing options...
Guest Posted December 3, 2002 Share Posted December 3, 2002 Hi Violet Check out this post: http://www.oscommerce.com/forums/viewtopic.php...ighlight=paypal Can you verify those files? Best regards Quote Link to comment Share on other sites More sharing options...
Guest Posted December 3, 2002 Share Posted December 3, 2002 YES! Thank you thank you thank you :))) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.