分类 电脑 下的文章

cpanel - 用不同的版本的php命令 - /opt/cpanel/ea-php72/root/usr/bin/php - An exception was raised while creating "Request"

现象:在cPanel环境中执行magento2的命令,如 php bin/magento cache:flush提示出错:

An exception was raised while creating "Request"; no instance returned

尝试:用正确的php版本路径再次执行,如 /opt/cpanel/ea-php72/root/usr/bin/php bin/magento cache:flush

参考:

Shell交互输入日期和时间,查询web日志统计条数

##!/bin/sh

dates=$1
month=$(date | awk '{print $2}')
years=$(date | awk '{print $6}')
hours=$2
minutes=$3
seconds=$4


if [ "$seconds" = "" ] && [ "$minutes" = "" ] && [ "$hours" = "" ]; then
        grep "$dates/$month/$years" access.log | grep 'MOBILENO_QUERY'| wc -l;
elif [ "$seconds" = "" ] && [ "$minutes" = "" ]; then
        grep "$dates/$month/$years:$hours" access.log | grep 'MOBILENO_QUERY'| wc -l;
elif [ "$seconds" = "" ]; then
        grep "$dates/$month/$years:$hours:$minutes" access.log | grep 'MOBILENO_QUERY'| wc -l;
else
        grep "$dates/$month/$years:$hours:$minutes:$seconds" access.log | grep 'MOBILENO_QUERY'| wc -l;
fi 

shell-date-weblog.png

参考:

自动延活ssh会话 - ssh -o "ServerAliveInterval 60" - Connection reset by port 22

问题:有些服务器,设置了一段时间后(如3分钟后)ssh会话无活动时会自动断开,出现 Connection reset by anqun.org port 22 的提示信息,不方便长时间使用。

尝试:如在Windows的MobaXterm客户端中,可运行如 ssh -o "ServerAliveInterval 60" root@anqun.org 的命令,自动每60秒发送数据,延续ssh会话。

参考:https://superuser.com/questions/699676/how-to-prevent-ssh-from-disconnecting-if-its-been-idle-for-a-while

magento - Invalid Form Key. Please refresh the page 错误 - 增大 max_input_vars 值

问题:新安装的magento2.3,在网站后台添加多个产品属性的新商品时,出错,提示 Invalid Form Key. Please refresh the page。环境是apache2.4和php。

尝试:

1.查看web错误日志,有如:

PHP Warning: Unknown: Input variables exceeded 1000. To increase the limit change max_input_vars in php.ini. in Unknown on line 0

2.更改php.ini中的 max_input_vars 的值到两万(默认是1000),如 max_input_vars = 20000

3.重启web服务

参考:https://www.simicart.com/blog/magento-2-invalid-form-key/

iRedMail - 修改附件大小

需求:iRedMail-0.9.9,nginx和centOS7环境。需通过邮件发送的附件增加到200M。

步骤:

1.先修改 postfix 的值:

postconf -e message_size_limit='254857600'
postconf -e mailbox_size_limit='254857600'

2.systemctl restart posfix # 重启postfix服务

3.修改php.ini的几个参数: /etc/php.ini

memory_limit = 1250M;
upload_max_filesize = 250M;
post_max_size = 250M;
max_input_time = 900
max_execution_time = 900

4.systemctl restart php-fpm # 重启php-fpm进程

5.修改nginx的参数:/etc/nginx/conf-enabled/client_max_body_size.conf
client_max_body_size 250m;

6.systemctl restart nginx # 重启nginx服务

参考:https://docs.iredmail.org/change.mail.attachment.size-zh_CN.html