如果docker run redis时,查看日志发现警告:

WARNING overcommit_memory is set to 0! Background save may fail under low memory cThe TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.

需要在docker run后面加入 --sysctl net.core.somaxconn=1024,如:

docker run --restart=always --name=redis --sysctl net.core.somaxconn=1024 -d -v /etc/redis:/etc/redis -p 6379:6379 redis:alpine redis-server /etc/redis/redis.conf --appendonly yes

解决 XmlDocument 在调用 LoadXml 方法时发生 hexadecimal value 0x08, is an invalid character 和 hexadecimal value 0x12, is an invalid character 等错误。

原因是有很多符号不能在XML代码中出现,所以我们要替换掉:

private string ReplaceHexadecimalSymbols(string txt)
{
	if (txt != "")
	{
		string r = "[\x00-\x08\x0B\x0C\x0E-\x1F]";
		return Regex.Replace(txt, r, "", RegexOptions.Compiled);
	}
	else
	{
		return "";
	}
}

解决执行 pecl upgrade-all 提示 Error getting channel info from pear.php.net: Connection to `ssl://pear.php.net:443' failed:Connection to 'ssl://pecl.php.net:443' failed: Unable to find the socket 错误。

出现这个错误主要是因为缺失默认证书导致的,具体原因不明。

下面说一下解决方案:

1、查看 default_cert_file 的路径

php -r "print_r(openssl_get_cert_locations());"

2、下载证书

wget -P /etc/ssl/ http://curl.haxx.se/ca/cacert.pem
chmod 744 /etc/ssl/cacert.pem

注意:其中 /etc/ssl/cacert.pem 替换为自己的真实路径

CentOS 7/8 安装 onigurumaoniguruma-devel 。解决 configure: error: Package requirements (oniguruma) were not met: Package 'oniguruma', required by 'virtual:world', not found 问题。

CentOS 7 安装

yum -y install http://mirror.centos.org/centos-7/7.7.1908/cloud/x86_64/openstack-queens/oniguruma-6.7.0-1.el7.x86_64.rpm
yum -y install http://mirror.centos.org/centos-7/7.7.1908/cloud/x86_64/openstack-queens/oniguruma-devel-6.7.0-1.el7.x86_64.rpm

备用下载:

oniguruma:http://down.24kplus.com/linux/oniguruma/oniguruma-6.7.0-1.el7.x86_64.rpm
oniguruma-devel:http://down.24kplus.com/linux/oniguruma/oniguruma-devel-6.7.0-1.el7.x86_64.rpm

CentOS 8 安装

yum config-manager --set-enabled PowerTools
yum -y install oniguruma oniguruma-devel

linux 系统没有自带 wget 工具。当用到 wget 如果没有安装就会出现 --bash: wget: command not found,需要我们自己安装。

CentOS 安装

yum install wget -y

Ubuntu 安装

apt install wget -y