lancaster_unik Posted November 23, 2006 Posted November 23, 2006 Hi Running MS2.2 on a Win2003 Server Recently upgraded the versions of PHP and MySQL to the latest release PHP 5.0.5 and MySQL 4.1 Since i did this I have experienced a few problems with my websites. I keep getting the following error Fatal error: Cannot redeclare tep_db_connect() (previously declared in D:\sites\forbidden-apple\public_html\catalog\admin\includes\functions\database.php:13) in D:\sites\forbidden-apple\public_html\catalog\admin\includes\functions\database.php on line 25 I have found this error in the following scenarios: 1) Updating the status of an order and including customer notification 2) Sending email via the admin control panel One other point to note is that I have recently installed a module called SMTPAUTH. I presumed this was working as all my carts emails were sending fine through an authenticated server however I have recently discovered that within the php.ini file there were some settings pre-configured. As this email host stopped working now I am wondering if the problem relates to these settings? Any Suggestions grately appreciated. Many Thanks
OceanRanch Posted November 23, 2006 Posted November 23, 2006 The following error message is shown when a main code file has been uploaded to the languages directory by accident. Cannot redeclare tep_db_connect() (previously declared in /home/username/public_html/store/includes/functions/database.php:13) Solution Upload the correct file to the languages/*/ directory where * is the name of the language you are using. **** In other words, you have mistakenly placed a PHP file with code that calls the included that defines the "database connection" on top of a PHP file that normally would only contain DEFINES. This then causes the the data base connect routine to be run twice and PHP errors out. ***** HTH Tom
lancaster_unik Posted November 24, 2006 Author Posted November 24, 2006 The following error message is shown when a main code file has been uploaded to the languages directory by accident. Cannot redeclare tep_db_connect() (previously declared in /home/username/public_html/store/includes/functions/database.php:13) Solution Upload the correct file to the languages/*/ directory where * is the name of the language you are using. **** In other words, you have mistakenly placed a PHP file with code that calls the included that defines the "database connection" on top of a PHP file that normally would only contain DEFINES. This then causes the the data base connect routine to be run twice and PHP errors out. ***** HTH Tom Tom Thanks for your answer... As this occured within the admin section of the site and on the following page shop/admin/orders.php?selected_box=customers&page=1&oID=1&action=update_order&osCAdminID=52mmasbks59u627du45f0ml061 I have re-uploaded the orders.php from a fresh install to the correct location. The problem still exists. I also dont see how this could have happend where the wrong file has been uploaded to the wrong location. I have never touched or uploaded any files to the admin section of this website. Even if by some mistake i had done this, A) It would not have happened on all the pages I highlighted to you B) I would not have done it on both websites. Seen as though it is extremely rare that this happens on one page. Is there another reason that this could occur? could it be as I suggest down to the PHP / MySQL version? Many Thanks Graham
OceanRanch Posted November 24, 2006 Posted November 24, 2006 Fatal error: Cannot redeclare tep_db_connect() The error clearly states that you are trying to "declare" the tep_db_connect function twice. You are just going to have to find the source file that has been mis-placed. No short cut here. Tom
lancaster_unik Posted November 27, 2006 Author Posted November 27, 2006 Fatal error: Cannot redeclare tep_db_connect() The error clearly states that you are trying to "declare" the tep_db_connect function twice. You are just going to have to find the source file that has been mis-placed. No short cut here. Tom Tom Thanks for your help on this. Yes I take your point it could be that I missed placed a file on two of my sites as I play around with them frequently but I am usually extremely careful that I place things in the correct locations. As the error that I have managed to generate seems to be orders.php i have copied these from virgin installs and placed them in the correct locations. Still the error. I checked an old site that I created before the two main ones and even that generated this error, I have not even looked at this site for well over 12 months. It is basically a virgin install of OSCommerce however I added the SMTPAUTH module for windows servers. This would basically disprove your theory that it is caused by a misplaced file? I take your point that it is trying to "re connect" but I dont think that I have misplaced any files. There must be a reason that it is showing this error. I was incorrect in saying that my hosts had upgraded my software. They inform me today that they havent however could one of these cause this? 1) Current settings for SMTP in the php ini will no longer work. System relies upon the SMTP auth function? 2) I have recently configured the built in MySQL client to run a daily SQL dump of all databases. This is for backup purposes. Could this have caused it? I apologise if I am being stupid but I am trying to ascertain all the things that we have changed before this error occured. Any Thoughts. I am going to try and install a virgin OSCOMMERCE installation and see if that generates the error. If it does then I definatly know its not your original suggestion Will keep this updated Any thoughts appreciated
OceanRanch Posted November 27, 2006 Posted November 27, 2006 You might want to perform a source search for both tep_db_connect and the include file database.php This will narrow down the files. If you find a language file with a database.php include that will propably be the cultprit. Tom
lancaster_unik Posted December 7, 2006 Author Posted December 7, 2006 You might want to perform a source search for both tep_db_connect and the include file database.php This will narrow down the files. If you find a language file with a database.php include that will propably be the cultprit. Tom Tom For your information.... I uninstalled the SMTP Auth mod rolled the email.php file in classes back to the original one and enabled the SMTP Service on my windows server, set the correct information in the ini file. The error no longer exists. Thanks for your help
Recommended Posts
Archived
This topic is now archived and is closed to further replies.