You get a bonus - 1 coin for daily activity. Now you have 1 coin

After moving OpenCart to another domain: Notice: unserialize() [function.unserialize]: Error at offset - index.php on line 45, header.php on line 43, index.php on line 61

Practice




after moving opencart to another domain

when logging into the admin panel

Notice: unserialize() [function.unserialize]: Error at offset 50 of 54 bytes in /home/....../admin/index.php on line 45

Fatal error: Call to a member function getId() on a non-object in /home/....../catalog/controller/common/header.php on line 43



when visiting the site

Notice: unserialize() [function.unserialize]: Error at offset 50 of 54 bytes in /home/..../index.php on line 61

check the configuration in the files

admin/config.php
and /config.php


clear the cache
/system/cache/


check the encoding of the image file names



run the query

delete
FROM `myprefix_setting`
where groupe='welcome'


make changes
in admin/index.php

replace on line 45

$config->set($setting['key'], unserialize($setting['value']));

with this
$config->set($setting['key'], unserialize($setting['value'])); if (!unserialize($setting['value'])) echo $setting['key']."==>".$setting['value']."
";


and you'll see what exactly is missing

indeed, the data in the serialized array was corrupted
after importing the database via phpmyadmin

in the table myprefix_setting
testimonial
testimonial_module


a:1:{i:1;a:8:{s:17:"testimonial_title";a:1:{i:2;s:12:"Отзывы";}s:17:"testimonial_limit";s:2:"10";s:18:"testimonial_random";s:1:"0";s:27:"testimonial_character_limit";s:3:"100";s:9:"layout_id";s:1:"9";s:8:"position";s:14:"content_bottom";s:6:"status";s:1:"0";s:10:"sort_order";s:0:"";}}


restored it manually and everything worked

Comments

Дмитрий 27-04-2018
Сначала долго завис на поиске ошибок в самой базе после перезалива через PhpMyAdmin!

А оказалось, что ошибка не в базе, а в инструменте перезалива (в моем случае PhpMyAdmin) - выполнил импорт через WorkBench и все прошло.

Вывод: Воспользуйтесь другим инструментом по работе с базой, но и конечно импортируйте заведомо не поврежденную БД!

To leave a comment

If you have any suggestion, idea, thanks or comment, feel free to write. We really value feedback and are glad to hear your opinion.
To reply

Lectures and tutorial on "Running server side scripts using PHP as an example (LAMP)"

Terms: Running server side scripts using PHP as an example (LAMP)