Jump to content

500 Internal Server Error after update


livetech

Recommended Posts

Hi All,

I have just updated a Version 4.1.1 to 5.0.6

All completed without issue.

Apart from a major issue in the admin area. If I navigate in my products in the admin area, I get the following error:-

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, [email protected] and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

If I look in the CubeCart_system_error_log - the last entry is as follows:-

File: [database.class.php] Line: [421] "ALTER TABLE `CubeCart_order_summary` ADD `lang` VARCHAR( 5 ) NULL " - Duplicate column name 'lang'

Where could I be getting this duplicate 'lang' column??

Cheers for any clues

Livetech

Link to comment
Share on other sites

Edit

There are a few more errors being thrown up

Today, 11:42 File: [database.class.php] Line: [421] "ALTER TABLE `CubeCart_order_summary` ADD `lang` VARCHAR( 5 ) NULL " - Duplicate column name 'lang'

Today, 11:41 File: [database.class.php] Line: [421] "ALTER TABLE `CubeCart_order_summary` ADD `basket` BLOB NULL DEFAULT NULL " - Duplicate column name 'basket'

Today, 11:41 File: [database.class.php] Line: [421] "ALTER TABLE `CubeCart_inventory` CHANGE `eanupc_code` `upc` VARCHAR( 12 ) NULL " - Unknown column 'eanupc_code' in 'CubeCart_inventory'

Today, 11:41 File: [database.class.php] Line: [421] "ALTER TABLE `CubeCart_inventory` ADD `ean` VARCHAR( 14 ) NULL AFTER `upc` " - Duplicate column name 'ean'

Today, 11:41 File: [database.class.php] Line: [421] "ALTER TABLE `CubeCart_inventory` ADD `jan` VARCHAR( 13 ) NULL AFTER `ean` " - Duplicate column name 'jan'

Today, 11:41 File: [database.class.php] Line: [421] "ALTER TABLE `CubeCart_inventory` ADD `isbn` VARCHAR( 13 ) NULL AFTER `jan` " - Duplicate column name 'isbn'

Today, 11:41 File: [database.class.php] Line: [421] "ALTER TABLE `CubeCart_inventory` CHANGE COLUMN `updated` `updated` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP " - Unknown column 'updated' in 'CubeCart_inventory'

Is this indicative of the database not upgrading correclty during the upgrade?

Link to comment
Share on other sites

I think these SQL error messages do not cause the 500 ISE.

For a different problem, I just went through the series of update files found in the update folder of CC5.0.6 that (I believe) progressively and sequentially changes the database from 4.0.0 to 5.0.5 (22 steps). Some of the later steps do require the successful execution of prior steps. For example:

4.1.0 adds the `date_added` column as TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP

Beta 1 adds the `updated` column as timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP

Beta 7 changes `date_added` columns to TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00'

Beta 7 changes the `updated` column to TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP

From your list of error messages for this example, I infer the files are not getting processed in the proper order. And while I think that this will cause other kinds of problems, I believe a 500 ISE is not being caused by missing table columns.

But you say the program crashes when you view the list of products in the admin screen, or when you view any specific product?

Link to comment
Share on other sites

I can view much of the admin area without issue - the issue arrises when I go to Products (which is fine) and click on a product to edit it. This is when I get the 500 internal error.

How would I go about running the update again? Take everything back to the old V4 and start again??

Link to comment
Share on other sites

"Running the update again."

If you can restore the database and code from a CC4.1.1 backup, yes, you can try again, but the results will be the same. However, you can engage the debug function and there will be a list of SQL queries that are executed where one can see the sequence of database updates. If any are out of sequence, this is where we can see it most easily.

If you are running your own server, you can engage the database manager's logging function to record the queries during the update.

If no backup, then in the table _history, you can delete all rows that mention versions greater than your last update (4.4.1). But that will probably cause multiple rows in a number of tables with duplicate entries. Overall, I can see a number of real and potential problems.

I've looked at the update code and found where the list of updates could be (initially) out-of-sequence, but a sort of the array of updates makes sure the updates get processed in order. So, I cannot find any place in the update loop where an out-of-sequence situation could unintentionally exist.

Just so we know, what is the exact version of PHP you have your store running under, and the exact operation system running the server?

Link to comment
Share on other sites

Hi All - I have now re-upgraded twice and still the same issue.

The last upgrade I did was to 5.0.1 (not 5.0.6) just to see it there was something wrong with the 4.1.1 to 5.0.6 process...

Still getting the 500 internal server error.

I think it may be due to the installation looking for ioncube, but this is not installed on the server. However Zend is. When I begin the install process - the compayability message shows the following

Compatibility Check

PHP 5.2.3+ - 5.2.17

MySQL 4.1+ - 5.0.92

GD Image Library - Installed

cURL - Installed

IonCube PHP Loader or Zend Optimizer - Installed

I will try again with your suggestions above - thanks guys - will let you know how it goes...

Link to comment
Share on other sites

Hi Guys,

Many thanks for the advice offered so far - I have tried again a few times and the process seems to be looking for a file called 500.shtml which is not present.

Using the Server Info link in the admin area it tells me the System is

Linux 2.6.18-274.7.1.el5PAE #1 SMP Thu Oct 20 17:03:59 EDT 2011 i686

Link to comment
Share on other sites

As a test I created a new folder on the same server, a new database and installed a new fresh V 5.0.6

This works without issue.

So the problem lies in the upgrade from V4, not the servers settings and running processes etc.

So, what is the way forward?

Fix why the upgrade is not following through correctly - or - Is there a way to import the products/customers/orders/settings from the old store to the new installation that is working without issue??

Cheers

Link to comment
Share on other sites

It goes without saying (but I will say it anyway) that the upgrade process needs fixed. But what we would really like to have is a peek at any error/debug logs that were used during the process on your attempt to upgrade.

The 500.shtml is the HTML document the server sends to the browser when the server can't figure out what to do. Unfortunately, the error notice delivered to you usually does not include the faulting script and line number.

I googled for "Linux 2.6.18" and didn't come across any screemin' meemies.

I also went through the code that displays a product for editing looking any obvious unchecked inputs (for example, array expected but string supplied) and didn't find anything obvious.

Not using CubeCart, do you have access to any error logs from your hosted account's control panel? Any logs maintained in your hosted space you download via FTP?

Link to comment
Share on other sites

Would you please create a file (call it 'testsort.php' for example) with the following contents, upload it to your store's main folder, and call for it in a browser:

<?php

$files_sql = glob(realpath(dirname(__FILE__)).DIRECTORY_SEPARATOR.'setup'.DIRECTORY_SEPARATOR.'db'.DIRECTORY_SEPARATOR.'upgrade'.DIRECTORY_SEPARATOR.'*.sql');

echo "<pre>";

var_dump($files_sql);

natsort($files_sql);

var_dump($files_sql);

echo "</pre>";

?>

There will be two lists, one right after the other. It will be obvious if the first list is not in alphabetical order. If not, we need to know this.

If the first list is not in alphabetical order, then is the second list in alphabetical order? If not, we need to know this.

The list is all the separate files that the database upgrade script processes. The upgrade needs to process them in sequence.

Link to comment
Share on other sites

Would you please create a file (call it 'testsort.php' for example) with the following contents, upload it to your store's main folder, and call for it in a browser:

<?php

$files_sql = glob(realpath(dirname(__FILE__)).DIRECTORY_SEPARATOR.'setup'.DIRECTORY_SEPARATOR.'db'.DIRECTORY_SEPARATOR.'upgrade'.DIRECTORY_SEPARATOR.'*.sql');

echo "<pre>";

var_dump($files_sql);

natsort($files_sql);

var_dump($files_sql);

echo "</pre>";

?>




There will be two lists, one right after the other. It will be obvious if the first list is not in alphabetical order. If not, we need to know this.



If the first list is not in alphabetical order, then is the second list in alphabetical order? If not, we need to know this.



The list is all the separate files that the database upgrade script processes. The upgrade needs to process them in sequence.

I'm assuming this is something that has to be in place BEFORE upgrading. I set it up on my site, but just got

I'll leave it there and use it when the 5.0.7 version comes out.


array(0) {

}

array(0) {

}

Link to comment
Share on other sites

@livetech:

The update cycle (supposedly) sorts the database scripts into version order. However, here's the problem...

CC5.0.0b1 released 14 Jan 2010

CC4.3.8 released 25 Jan 2010

CC4.4.5 was released 2 May 2011

CC5.0.0b7 released 21 May 2011

CC5.0.1 released 19 Jul 2011

From my analysis, 4.4.5 already has quite a bit of the database structure that Beta1 attempts to modify the database to have.

Beta1 seems to have been coded to upgrade from a 4.3.X database structure and so will attempt to make changes that are not relevant to a 4.4.5 database structure. This explains nearly all the "duplicate column name" errors.

Be aware that the 5.0.0b1 database upgrade script has itself been "fixed" several times in the various versions since Beta1. I believe there are still problems in the b1 script.

Having said that, there are a few tests I would like for you to do. The first is to look at the database directly using phpMyAdmin or some other tool. In the table CubeCart_category_index, 'primary' column, there should be 0's or 1's. Mostly 1's if you have not aggressively assigned secondary categories to products.

The second test, in the file /admin/sources/products.index.inc.php around line 594, change if ($translations) { to if (false && $translations) {.

This section of code is the only process that is not coded the same as the others nearby. So, I want to switch this off. Does the "Edit Product" screen appear?

Also, from the list of products, if you click on the Add Product tab, do you get a screen here?

Link to comment
Share on other sites

Having said that, there are a few tests I would like for you to do. The first is to look at the database directly using phpMyAdmin or some other tool. In the table CubeCart_category_index, 'primary' column, there should be 0's or 1's. Mostly 1's if you have not aggressively assigned secondary categories to products.

Yes, mostly 1's with the others showing 0

The second test, in the file /admin/sources/products.index.inc.php around line 594, change if ($translations) { to if (false && $translations) {.

This section of code is the only process that is not coded the same as the others nearby. So, I want to switch this off. Does the "Edit Product" screen appear?

Same 500 error when tryihng to edit a product

Also, from the list of products, if you click on the Add Product tab, do you get a screen here?

Same error.

However - if we make the following change then Add Product and Edit Product work.

Commented out

$this->_cat_path[] = $this->getDirectory($category['cat_parent_id'], $link, $glue, $append, $custom);

in public function getDirectory in seo.class.php

So, getting closer to working out where the issue is.....

Link to comment
Share on other sites

It seems that there was an issue with the Category ID's in the database.

In table "CubeCart_category" ...

The parent id of cat_id=6 is 7

The parent id of cat_id=7 is 40

The parent id of cat_id=40 is 6

It creates an infinite loop

So, we just changed the parent id of cat_id=40 to 31

Link to comment
Share on other sites

Can you give a paragraph on the work you did to come to the hypothesis that this line of code was the best place to make an experiment? And what prompted your thinking to examine the parent paths?

This might help us figure out how to discover a particular sequence of steps to recreate a loop of parent paths.

Or do you recall forcing a category to have a parent by manually editing the database?

Thank you for your discoveries.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...