Unsuccessful migration and upgrade

I am trying to migrate and upgrade an OJS 2.4.4.1 form a Windows (Apache 2.2, PHP 5.3.27, MySQL 5.6) host to an OJS 3.1.2 on a CentOS (Apache 2.4.6, PHP7.1.28, MariaDB 5.5.60).

I exported the old DB into a .sql dump file with the MySQL Workbench and then imported it via command line, copied the public and files folders from and edited config.inc.php accordingly. Then I ran the upgrade script from the tools folder and got the message that the upgrade was successful, and I can log in with the old admin account. But then I have all sorts of problems.

On the homepage I noticed that there are no special characters although everything is set to UTF-8 (config.inc.php, Apache and database). Some names are left out entirely if they contain special characters (ščž). The other thing is that I get "An unexpected error has occurred. Please reload the page and try again" when I click on "submissions" and if I click on "Users & Roles > Users" the list keeps loading into infinity.

During the upgrading process, I got some repeating warnings like:

> PHP Notice: unserialize(): Error at offset 4364 of 25291 bytes in /var/www/html/lib/pkp/classes/db/DAO.inc.php on line 352

And

> PHP Warning: Cannot use a scalar value as an array in /var/www/html/lib/pkp/classes/core/DataObject.inc.php on line 133

What could be the problem? What part of my procedure could have caused such behavior?

Hi @Stasis

Can you show php errors behind those issues?
Can you confirm that your old database also had UTF-8 encoding?

Thank you for the reply.

Database info on the new (CentOS) server:

+------------------------+-------+
| Variable_name          | Value |
+------------------------+-------+
| character_set_database | utf8  |
+------------------------+-------+

Database information from the old (Windows) server using MySQL Workbench:

workbench%20information

The PHP errors from /etc/httpd/error_log seems to be something like:

[Tue Apr 09 10:43:57.724573 2019] [php7:warn] [pid 2830] [client ip:port]
PHP Warning:  Cannot use a scalar value as an array in /var/www/html/lib/pkp/classes    /core/DataObject.inc.php on line 133, referer: http://url/index.php/AK/management/settings/access
[Tue Apr 09 10:43:57.724632 2019] [php7:notice] [pid 2830] [client ip:port] PHP Notice:  unserialize(): Error at offset 1054 of 8709 bytes in /var/www/html/lib/pkp/classes/db/DAO.inc.php on line 352, referer: http://url/index.php/AK/management/settings/access
[Tue Apr 09 10:43:57.906784 2019] [php7:notice] [pid 2833] [client ip:port] Malformed UTF-8 characters, possibly incorrectly encoded, referer: http://url/index.php/AK/management/settings/access

So yeah, it seems like a problem with encoding but where can I set that?

Regards

And the localisation settings fromt he config.inc.php file. The same settings work fine on the old server, so I am not sure where else to look for encoding misconfiguration.

[i18n]

; Default locale
locale = en_US

; Client output/input character set
client_charset = utf-8

; Database connection character set
; Must be set to "Off" if not supported by the database server
; If enabled, must be the same character set as "client_charset"
; (although the actual name may differ slightly depending on the server)
connection_charset = Off

; Database storage character set
; Must be set to "Off" if not supported by the database server
database_charset = Off

; Enable character normalization to utf-8 (recommended)
; If disabled, strings will be passed through in their native encoding
; Note that client_charset and database collation must be set
; to "utf-8" for this to work, as characters are stored in utf-8
charset_normalization = Off

The MariaDB server was not set to UTF-8.

I just added these lines in the /etc/my.cnf file:

[client]
...
default-character-set=utf8mb4
...
[mysql]
...
default-character-set=utf8mb4
...
[mysqld]
...
collation-server = utf8mb4_unicode_ci
init-connect='SET NAMES utf8mb4'
character-set-server = utf8mb4
...

Have not tested the site thoroughly, but I think this is it.

1 Like

Did you change Mysql by Mysqli ?

Yes, the upgrade would not go through without that. But as I mentioned in my previous post, I solved my problem by editing the /etc/my.cnf file of the MariaDB server, which was not set to UTF-8.

Regards