girl Posted July 5, 2009 Posted July 5, 2009 Hi, I tried to install a module and saved all the files I altered, did backup(s) of the database. Since the installation of the module did not work out I added back the files and restored the database. All seems to be okay expect when I go into admin panel of the store and customers/ orders I get this error Fatal error: Cannot redeclare tep_db_connect() (previously declared in /home/userename/public_html/catalog/admin/includes/functions/database.php:13) in /home/username/public_html/store/admin/includes/functions/database.php on line 25 Is this error due to data on a php file or is it a database error? The module called for admin/order.php to be altered could that be the problem - some how the pre-altered one got changed? I had problems restoring the data base as I was having time outs with the server. When I run a test order it goes to the database it is just that I get this above error when accessing the order through the osc admin panel. thanks if you can help.
Pektsekye Posted July 5, 2009 Posted July 5, 2009 Fatal error: Cannot redeclare tep_db_connect() (previously declared in /home/userename/public_html/catalog/admin/includes/functions/database.php:13) in /home/username/public_html/store/admin/includes/functions/database.php on line 25 Hello, Have a look: /home/userename/public_html/catalog/admin/includes/functions/database.php /home/username/public_html/store/admin/includes/functions/database.php The same file is called twice from different locations Stanislav
girl Posted July 5, 2009 Author Posted July 5, 2009 Hello, Have a look: /home/userename/public_html/catalog/admin/includes/functions/database.php /home/username/public_html/store/admin/includes/functions/database.php The same file is called twice from different locations Stanislav sorry about that is my error. I was changing the name store to catalogs for forum sake. so it reads /home/userename/public_html/catalog/admin/includes/functions/database.php /home/username/public_html/catalog/admin/includes/functions/database.php
Pektsekye Posted July 5, 2009 Posted July 5, 2009 sorry about that is my error. I was changing the name store to catalogs for forum sake. so it reads /home/userename/public_html/catalog/admin/includes/functions/database.php /home/username/public_html/catalog/admin/includes/functions/database.php Hello, Show the content of your catalog/admin/includes/functions/database.php here Stanislav
girl Posted July 5, 2009 Author Posted July 5, 2009 Hello, Show the content of your catalog/admin/includes/functions/database.php here Stanislav here is the data <?php /* $Id: database.php,v 1.23 2003/06/20 00:18:30 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2003 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 (defined('STORE_DB_TRANSACTIONS') && (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 (defined('STORE_DB_TRANSACTIONS') && (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 htmlspecialchars($string); } function tep_db_input($string, $link = 'db_link') { global $$link; if (function_exists('mysql_real_escape_string')) { return mysql_real_escape_string($string, $$link); } elseif (function_exists('mysql_escape_string')) { return mysql_escape_string($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; } } ?>
Pektsekye Posted July 5, 2009 Posted July 5, 2009 sorry about that is my error. I was changing the name store to catalogs for forum sake.so it reads /home/userename/public_html/catalog/admin/includes/functions/database.php /home/username/public_html/catalog/admin/includes/functions/database.php Hello But the urls are different again: /home/userename/public_html/catalog/admin/includes/functions/database.php /home/username/public_html/catalog/admin/includes/functions/database.php If not the urls try to update this file from fresh oscommerce package or restart the server Stanislav
girl Posted July 5, 2009 Author Posted July 5, 2009 Hello But the urls are different again: /home/userename/public_html/catalog/admin/includes/functions/database.php /home/username/public_html/catalog/admin/includes/functions/database.php If not the urls try to update this file from fresh oscommerce package or restart the server Stanislav no that is my typo - in the original error they are they same :( I just change my username and catalog name in the address. I copied a new database.php form a souce store but still get the error. I guess it is the database not restoring properly :( as the restorer server times out on the restore.
Pektsekye Posted July 5, 2009 Posted July 5, 2009 no that is my typo - in the original error they are they same :( I just change my username and catalog name in the address.I copied a new database.php form a souce store but still get the error. Hello, Cannot redeclare tep_db_connect The server tries to redeclare function on its end It means that it no longer understand what is it doing The restart of the server can help I guess it is the database not restoring properly :( as the restorer server times out on the restore. It doesn't even get ready to connect to the database. As the error returned from it means "I don't understand the code and I cannot execute it" Stanislav
Pektsekye Posted July 5, 2009 Posted July 5, 2009 Hi,I tried to install a module and saved all the files I altered, did backup(s) of the database. Since the installation of the module did not work out I added back the files and restored the database. All seems to be okay expect when I go into admin panel of the store and customers/ orders I get this error Fatal error: Cannot redeclare tep_db_connect() (previously declared in /home/userename/public_html/catalog/admin/includes/functions/database.php:13) in /home/username/public_html/store/admin/includes/functions/database.php on line 25 Is this error due to data on a php file or is it a database error? The module called for admin/order.php to be altered could that be the problem - some how the pre-altered one got changed? I had problems restoring the data base as I was having time outs with the server. When I run a test order it goes to the database it is just that I get this above error when accessing the order through the osc admin panel. thanks if you can help. Hello, To be sure that the database.php is the problem file you can try to add one line before the line 13 and one line before the line 25. Then the error should become : database.php:14) in ... on line 27 If so - restart the server to make it understand the code correctly Stanislav
girl Posted July 5, 2009 Author Posted July 5, 2009 Hello, To be sure that the database.php is the problem file you can try to add one line before the line 13 and one line before the line 25. Then the error should become : database.php:14) in ... on line 27 If so - restart the server to make it understand the code correctly Stanislav Yes when I added the lines I got the above error. How do I restart the server? Do I need to ask my host to do it?
Pektsekye Posted July 5, 2009 Posted July 5, 2009 Yes when I added the lines I got the above error. How do I restart the server? Do I need to ask my host to do it? Hello, You should ask your host support for it. Show them the error and the file. Stanislav
girl Posted July 5, 2009 Author Posted July 5, 2009 Hello, You should ask your host support for it. Show them the error and the file. Stanislav Yeh :( been talking with them for almost 12 hours now, and basically they say I can buy a dedicated server; they can't restore the my site/ server as it is shared, and if I wish to restore a backup I need to pay - don't mind that the problem is most likely caused by the time out they put in system that I can't restore a data base of 4MB completely. Oh well I guess it means looking for a new host or starting the site over or one in parallel as the shop is live. Thanks for your help and time. jehanne
♥ecartz Posted July 5, 2009 Posted July 5, 2009 Fatal error: Cannot redeclare tep_db_connect() (previously declared in /home/userename/public_html/catalog/admin/includes/functions/database.php:13) in /home/username/public_html/store/admin/includes/functions/database.php on line 25This is unlikely to be a problem in the database.php file. It is more likely that the database.php file is being called multiple times. A common explanation for this after installing a contribution is that a regular page file was installed as a language file. I would check that you restored the correct backup of includes/languages/english/orders.php (or whatever language if not english). The wrong one would have the following line in it: require('includes/application_top.php'); Always back up before making changes.
girl Posted July 5, 2009 Author Posted July 5, 2009 This is unlikely to be a problem in the database.php file. It is more likely that the database.php file is being called multiple times. A common explanation for this after installing a contribution is that a regular page file was installed as a language file. I would check that you restored the correct backup of includes/languages/english/orders.php (or whatever language if not english). The wrong one would have the following line in it: require('includes/application_top.php'); Oh I am so happy I could kiss you. Thank you it worked!!! my site is running as normal again. I will have to be much more careful next time I attempt a module.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.