Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specified key was too long; max key length is 767 bytes #8

Open
pprw opened this issue Feb 8, 2019 · 3 comments
Open

Specified key was too long; max key length is 767 bytes #8

pprw opened this issue Feb 8, 2019 · 3 comments
Assignees

Comments

@pprw
Copy link

pprw commented Feb 8, 2019

I have this error when installing the plugin:


Omeka a rencontré une erreur

Zend_Db_Statement_Mysqli_Exception

    Mysqli statement execute error : Specified key was too long; max key length is 767 bytes

Zend_Db_Statement_Mysqli_Exception: Mysqli statement execute error : Specified key was too long; max key length is 767 bytes in /sites/rhpstweb/www/web_main/application/libraries/Zend/Db/Statement/Mysqli.php:214
Stack trace:
#0 /sites/rhpstweb/www/web_main/application/libraries/Zend/Db/Statement.php(303): Zend_Db_Statement_Mysqli->_execute(Array)
#1 /sites/rhpstweb/www/web_main/application/libraries/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
#2 /sites/rhpstweb/www/web_main/application/libraries/Omeka/Db.php(79): Zend_Db_Adapter_Abstract->query('\n        CREATE...')
#3 /sites/rhpstweb/www/web_main/plugins/Stats/StatsPlugin.php(155): Omeka_Db->__call('query', Array)
#4 /sites/rhpstweb/www/web_main/application/libraries/Omeka/Plugin/Broker.php(145): StatsPlugin->hookInstall(Array)
#5 /sites/rhpstweb/www/web_main/application/libraries/Omeka/Plugin/Installer.php(130): Omeka_Plugin_Broker->callHook('install', Array, Object(Plugin))
#6 /sites/rhpstweb/www/web_main/application/controllers/PluginsController.php(97): Omeka_Plugin_Installer->install(Object(Plugin))
#7 /sites/rhpstweb/www/web_main/application/libraries/Zend/Controller/Action.php(516): PluginsController->installAction()
#8 /sites/rhpstweb/www/web_main/application/libraries/Zend/Controller/Dispatcher/Standard.php(308): Zend_Controller_Action->dispatch('installAction')
#9 /sites/rhpstweb/www/web_main/application/libraries/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#10 /sites/rhpstweb/www/web_main/application/libraries/Zend/Application/Bootstrap/Bootstrap.php(105): Zend_Controller_Front->dispatch()
#11 /sites/rhpstweb/www/web_main/application/libraries/Zend/Application.php(384): Zend_Application_Bootstrap_Bootstrap->run()
#12 /sites/rhpstweb/www/web_main/application/libraries/Omeka/Application.php(77): Zend_Application->run()
#13 /sites/rhpstweb/www/web_main/admin/index.php(28): Omeka_Application->run()
#14 {main}

@Daniel-KM Daniel-KM self-assigned this Mar 18, 2019
@Daniel-KM
Copy link
Owner

It looks like an incompatibility with recent database.

@biguenique
Copy link

Hello and thanks for your wonderful plugins.

I got the very same error. You can find an explanation of the error here.

I was luckily able to fix the issue by doing the following changes and crossing my fingers.

In /plugins/Stats/StatsPlugin.php, public function hookInstall(), simply spot any varchar column with a length of 1024 in the SQL statements, and change its lenght to... 767, specifying latin1 as its CHARACTER SET and changing COLLATE from utf8_unicode_ci to latin1_general_ci. Which gives us these 3 consecutive modified lines :

        `referrer` varchar(767) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL DEFAULT '',
        `query` varchar(767) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL DEFAULT '',
        `user_agent` varchar(767) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL DEFAULT '',

@biguenique
Copy link

It seems to me that most of the text columns in both Stat and Hit tables (excepted perhaps record_type) could actually be stored in latin1 (or even ascii?) since they store HTTP header string data, which usually never awakes the 8th bit. That could produce a much slimmer data set.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants