分类 电脑 下的文章

magento - 导入图片 - 图片目录设置 - Images File Directory - pub/media/import

问题:magento2后台,导入商品时,检查有效,但结果失败:Imported resource (image) could not be downloaded from external resource due to timeout or access permissions in row(s): 1, 37

尝试:设置图片目录里,如果图片已经上传到服务器的pub/media/productpics目录里,请填写:pub/media/productpics (不用/打头)。

magento-import-images-directory-1.png

参考:https://magento.stackexchange.com/questions/109066/magento-2-product-import-wont-import-images

magento1.x - CSS文件加载失败 - 禁用 SELinux

现象:重装CentOS系统后,迁回magento1.x的站点,打开网页时,格局错乱,很多.js和CSS文件提示403拒绝访问。

过程:

1.查看Web日志,有如这样的错误信息:[access_compat:error] [pid 13908] [client 220.243.135.218:61156] AH01797: client denied by server configuration: /var/www/sites/chinastonejewelry/var/www

2.setenforce 0 # 立即禁用SELinux功能,如果需彻底关闭,请更改 /etc/selinux/config 里的值

参考:https://docs.iredmail.org/install.iredmail.on.rhel.html#disable-selinux

monicahq - 修复图片链接路径 - php artisan storage:link

现象:在monica里,可以上传图片,但不会显示。从浏览器里直接访问图片URL,提示404未找到。如:/storage/photos/h4DBeuTT03p35n8z5tRcYUatnWIstfp1bZNA6MPH.jpeg

过程:

1.查看路径/storage/app/public/photos/里有新上传的图片,但/public/storage/photos里没有

2.删除或改名/public/storage/

3.php artisan storage:link #运行管理命令,重新创建软链接 /public/storage/ 到 /storage/app/public/

monica-storeage-linkpng.png

参考:https://github.com/monicahq/monica/issues/702

用telnet测试远程smtp发信

问题:如想简单测试远程smtp账户信息是否正确,能否发信,用telnet可以吗?

尝试:

telnet 148.163.x.x 25
Trying 148.163.x.x...
Connected to 148.163.x.x.
Escape character is '^]'.
220 mail.xxx.com ESMTP Postfix
EHLO mail.xxx.com # 打招呼
250-mail.xxx.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-AUTH PLAIN LOGIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
AUTH LOGIN # 请求验证
334 VXNlcm5hbWU6
bGl1b2ZvQHVwdXN0cm333333bQ== # base64加密后的用户名
334 UGFzc3dvcmQ6 
MXEydz44444Tg3 # base64加密后的密码
535 5.7.8 Error: authentication failed: UGFzc3dvcmQ6 #验证错误
AUTH LOGIN
334 VXNlcm5hbWU6
bGl3333v
334 UGFzc3dvcmQ6
MXEydz44443
235 2.7.0 Authentication successful #验证成功
MAIL FROM:liuo@xxx.com # 发件人
250 2.1.0 Ok
RCPT TO:liu@anqun.net #收件人
250 2.1.5 Ok
DATA #开始写信
354 End data with <CR><LF>.<CR><LF>
Subject:Sending email using Telnet #标题

This is just a simple test.
. # 写信结束
250 2.0.0 Ok: queued as 4831E40AFD2B
QUIT #退出
221 2.0.0 Bye
Connection closed by foreign host.

telnet-smtp-auth-test.png

如想在Linux的Shell里一句话发信测试,可:echo "Subject: hello" | sendmail liu@anqun.net

参考:https://www.kongtechnology.com/2008/01/27/smtp-authentication-and-send-emails-using-telnet/

magento - php bin/magento setup:di:compile - 出错 - 删除 vendor/temando 目录后补回

现象:magento2一键包的文件,在执行 php bin/magento setup:di:compile 命令时出错,提示:PHP Fatal error: Declaration of Temando\Shipping\Model\ResourceModel\Carrier\Collection::fetchData() must be compatible with Temando\Shipping\Model\ResourceModel\Webservice\Collection...

尝试:

1.php bin/magento module:disable Temando_Shipping # 禁用该模块,重新执行setup:di:compile,还是一样错误

2.删除 vendor/temando 目录,然后用官方相同版本的文件复制回原路径

3.重新执行setup:di:compile,正常了

4.php bin/magento module:enable Temando_Shipping # 如需要,可重新启用该模块

参考: