如何解决OroCommerce 不会与收到的电子邮件同步
无论我做什么,我都无法让 OroCommerce 与收到的电子邮件同步。我使用文档安装了 OroCommerce,我针对 utf8mb4/unicode 优化了我的 mysql,我检查了 utf8mb4 的学说 dbal 设置,但根本没有电子邮件会同步。起初我正在尝试使用 OroCrm 进行 thsi 并且我在消息消耗方面遇到错误,某些原因 OroCommerce 没有给出这些问题......或者也许只是每 30 次以上重新安装一次。
无论如何,在几年前我发现的一篇帖子中提到尝试bin/console oro:cron:imap-sync。这给了我一个线索,这就是为什么我尝试优化我的数据库并使 utf8mb4 的所有设置正确(按照指南@ https://doc.oroinc.com/backend/setup/system-requirements/database-optimization/ 然后重新安装 OroCommerce)。
这是我通过同步命令得到的当前错误集:
[myaccount@vegas crm]$ bin/console oro:cron:imap-sync
Resetting hanged email origins ...
Updated 0 row(s).
Finding an email origin ...
Found "my@email.com (vegas.myserver.net)" email origin. Id: 39.
Get folders enabled for sync...
Got 2 folder(s).
The folder "INBOX" is selected.
Previous max email UID "0"
Found 33 email(s).
The synchronization failed. Error: An exception occurred while executing 'INSERT INTO oro_email (serialized_data,created,subject,from_name,sent,importance,internaldate,is_head,message_id,multi_message_id,x_message_id,x_thread_id,refs,acceptLanguageHeader,body_synced,from_email_address_id,thread_id,email_body_id) VALUES (?,?,?)' with params ["Tjs=","2021-04-29 03:14:09","Your contacts in Senders Company \ud83d\udcc7","Senders Name <senders@email.com>","2021-03-12 16:00:07","2021-03-12 16:01:25",1,"<20210312160007.1.FA8089C7D91E83BD@cio42337.sendersemail.com>",null,"",107,null]:
SQLSTATE[HY000]: General error: 1366 Incorrect string value: '\xF0\x9F\x93\x87' for column 'subject' at row 1
The synchronization failed. Error: An exception occurred while executing 'INSERT INTO oro_email (serialized_data,null]:
SQLSTATE[HY000]: General error: 1366 Incorrect string value: '\xF0\x9F\x93\x87' for column 'subject' at row 1
Finding an email origin ...
Found "my@email.com (vegas.myserver.net)" email origin. Id: 39.
Exit because all origins have been synchronised.
In AbstractEmailSynchronizer.php line 622:
The email synchronization failed for the following origins: 39.
我的服务器设置: CentOS Linux 7.9.2009 版(核心) mysql 版本:mysqld Ver 5.7.34 php 7.4.16 面板
我的.cnf:
[mysqld]
innodb_file_per_table = 0
wait_timeout = 28800
performance-schema=0
optimizer_search_depth=0
character-set-server=utfmb4
character-set-server=utf8mb4
collation-server=utf8mb4_unicode_ci
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server,else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed,experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
innodb_buffer_pool_size=134217728
max_allowed_packet=268435456
open_files_limit=40000
innodb_file_per_table=1
[client]
default-character-set = utf8mb4
任何能帮助我解决这个问题的人,我将不胜感激。在过去的 3 天里,我一直在反复踢 orocommerce。有时我会收到略有不同的错误,但这个错误似乎非常一致,我很想跳过安装阶段。
谢谢
解决方法
首先,你的Mysql配置好像有错别字:
character-set-server=utfmb4
character-set-server=utf8mb4
应该换成
character-set-server=utf8mb4
一旦修复并重新启动 MySQL 服务器,请尝试通过运行以下 SQL 查询来检查配置值是否正确应用:
SHOW VARIABLES LIKE 'character_set_%';
如果编码不正确 - 您必须先修复配置。
此外,您可以尝试使用以下值更新应用程序配置(config/config.yml 文件),这应该强制执行默认编码:
doctrine:
dbal:
connections:
default:
options:
# PDO::MYSQL_ATTR_INIT_COMMAND
1002: 'SET NAMES utf8mb4,@@SESSION.optimizer_switch="block_nested_loop=off";'
无论如何,如果您在更改默认字符集之前创建了数据库,则数据库可能仍使用旧设置,您必须转换数据库编码,如下例所示: How to convert an entire MySQL database characterset and collation to UTF-8?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。