开发者

Magento - Base Table core_file_storage Doesn't exist

When I look in the error log for my Magento store it is full of these errors:

[02-Jun-2011 13:49:12] PHP Fatal error:  Uncaught exception 'PDOException' with message 'SQLSTATE[42S02]: Base table or view not found: 1146 Table 'mysite_mysite.core_file_storage' doesn't exist' in /home/mysite/public_html/lib/Zend/Db/Statement/Pdo.php:228
Stack trace:
#0 /home/mysite/public_html/lib/Zend/Db/Statement/Pdo.php(228): PDOStatement->execute(Array)
#1 /home/mysite/public_html/lib/Zend/Db/Statement.php(300): Zend_Db_Statement_Pdo->_execute(Array)
#2 /home/mysite/public_html/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
#3 /home/mysite/public_html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SELECT `e`.* FR...', Array)
#4 /home/mysite/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(337): Zend_Db_Adapter_Pdo_Abstract->query('SELECT `e`.* FR...', Array)
#5 /home/mysite/public_html/lib/Zend/Db/Adapter/Abstract.php(753): Varien_Db_Adapter_Pdo_Mysql->query(Object(Varien_Db_Select), Array)
#6 /home/mysite/public_html/app/code/core/M开发者_StackOverflowage/Core/Model/Mysql4/File/Storag in /home/mysite/public_html/lib/Zend/Db/Statement/Pdo.php on line 234

Anyone know how to solve this?


Apparently I do not yet have the privileges to comment on Daniel's answer, therefore I'm adding this as a separate answer. User a1anm also asked the question on the Magento Forum. There, user furnitureforyoultd answered the question with two different queries.

First, if you do not yet have core_directory_storage, run:

CREATE TABLE `core_directory_storage` (
  `directory_id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  `name` VARCHAR(255) NOT NULL DEFAULT '',
  `path` VARCHAR(255) NOT NULL DEFAULT '',
  `upload_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `parent_id` INT(10) UNSIGNED NULL DEFAULT NULL,
  PRIMARY KEY (`directory_id`),
  UNIQUE INDEX `IDX_DIRECTORY_PATH` (`name`, `path`),
  INDEX `parent_id` (`parent_id`),
  CONSTRAINT `FK_DIRECTORY_PARENT_ID` FOREIGN KEY (`parent_id`) REFERENCES `core_directory_storage` (`directory_id`) ON UPDATE CASCADE ON DELETE CASCADE
) COMMENT='Directory storage' COLLATE='utf8_general_ci' ENGINE=InnoDB ROW_FORMAT=DEFAULT;

Then, run:

CREATE TABLE `core_file_storage` (
  `file_id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  `content` LONGBLOB NOT NULL,
  `upload_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `filename` VARCHAR(255) NOT NULL DEFAULT '',
  `directory_id` INT(10) UNSIGNED NULL DEFAULT NULL,
  `directory` VARCHAR(255) NULL DEFAULT NULL,
  PRIMARY KEY (`file_id`),
  UNIQUE INDEX `IDX_FILENAME` (`filename`, `directory`),
  INDEX `directory_id` (`directory_id`),
  CONSTRAINT `FK_FILE_DIRECTORY` FOREIGN KEY (`directory_id`) REFERENCES `core_directory_storage` (`directory_id`) ON UPDATE CASCADE ON DELETE CASCADE
) COMMENT='File storage' COLLATE='utf8_general_ci' ENGINE=InnoDB ROW_FORMAT=DEFAULT;


It's the issue in Magento core, that is added to tracker and will be fixed.

However, you should be aware that the source of this error is that you're having url to non-existent file. The only problem in Magento core is that it throws "Fatal error" instead of showing a 404 page.

To fix this trouble, check why you get an url to non-existent file. Either rights to your Media folder and subfolders must be set properly - e.g. 777 (otherwise images are not created there) or url is formed wrong.


You should not create tables manually, just check permissions for your media folder (must be 777).


These tables are mainly used for storing uploaded images for each product.

Furthermore, if your default storage for media is set to files and not to database, magento will try to look for each image in the file system, but if it fails, it will try to look it up in the database.

Please check whether your product images are in the media folder (typically media/catalog/product/{a-z|0-9}/{a-z|0-9}/yourimage.jpg) otherwise, even after creating those tables, you will only recive a 404 Not found error when requesting those files.


This problem happened to me and I have to give 777 permission to the media folder.


also, please note that if you attempt to use illegal characters in the title of the product eg quotes this will cause magento to try and create a thumbnail with this character in it.. which will cause the images to fail and magento will try to call these images from the database.. if you are not using the database for storage you will see the mysql error


If you will be using filesystem storage, Make sure your /media directory is set to 777 and also run chmod -R o+w media. If the error persists, the cleanest way to solve the problem is as follows:

  1. Go to SYSTEM>CONFIGURATION>ADVANCED>SYSTEM and switch "Storage Configuration for Media" to "Database". Click SYNCHRONIZE. Wait for the synchronization process to finish or time out (likely, depending on your settings). The table "core_directory_storage" has been created and filled up. Click on SAVE CONFIG (not sure if this step is necessary, but do it anyways).
  2. If the synchronization process timed out, you will likely see a notification about a major error in the Magento Admin "An error has occured while syncronizing media storages.". It doesn't matter because in the next step we are reverting back to file based media storage.
  3. In the same setting adjusted in step #1, switch back to "File System" and click SYNCHRONIZE again. Click on SAVE CONFIG (not sure if this step is necessary, but do it anyways).
  4. Now go to your DB Manager (PHPMyAdmin for example) and delete all rows in the recently created table using DELETE FROM core_directory_storage.

Your table missing error is now gone.


The missing tables can be create automatically by the system, all you need to do is go to:

System > Configuration
System (Advanced menu) > "Storage Configuration for Media" tab

and choosing to store media files in DB, and then turning it off after the synchronization is complete. This will create the missing tables.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜