cURL error 60: SSL certificate problem: unable to get local issuer certificate (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)

CURL证书错误问题正确解决方法

方法1:自己自己下载一个根证书(不推荐)
下载地址:https://github.com/bagder/ca-bundle

// curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0);
// curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);
# curl_setopt($ch, CURLOPT_CAPATH, __DIR__);
curl_setopt($ch, CURLOPT_CAINFO, __DIR__ . '/ca-bundle.crt');

方法2:自动找到系统里的证书路径(推荐)

# 安装
composer require composer/ca-bundle
# 通过下面方法即可返回证书路径
\Composer\CaBundle\CaBundle::getSystemCaRootBundlePath()
// curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0);
// curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);
# curl_setopt($ch, CURLOPT_CAPATH, __DIR__);
curl_setopt($ch, CURLOPT_CAINFO, \Composer\CaBundle\CaBundle::getSystemCaRootBundlePath());

GuzzleHttp https证书问题解决

$client = new \GuzzleHttp\Client([
    \GuzzleHttp\RequestOptions::VERIFY => \Composer\CaBundle\CaBundle::getSystemCaRootBundlePath()
]);

Nginx Yum安装(官方)

To set up the yum repository, create the file named /etc/yum.repos.d/nginx.repo with the following contents:

[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key

MySQL二进制日志清理

  1. 查看过期天数

show variables like ‘%logs%’;

2. 设置过期天数(最大值为99)

set global expire_logs_days = 99;

MySQL8.0 支持binlog_expire_logs_seconds参数,顾名思义就是日志过期秒数。

自动二进制日志文件删除的天数。 默认值为0,表示“不自动删除”。 可能的删除发生在启动时和二进制日志刷新。

2.1 生效问题

flush logs;

如果你发现设置没有生效,可能需要执行此命令。

3. 查看现有的日志文件

SHOW BINARY LOGS;

4. 手动清理较旧日志

PURGE BINARY LOGS TO ‘mysql-bin.000007’;

将mysql-bin.000007以前的日志清理掉,又或者

PURGE BINARY LOGS BEFORE ‘2018-01-06 12:12:12’;

将2018-01-06 12:12:12以前的日志清理掉

5. 修改MySQL配置文件

expire_logs_days = 99

 

create table和主从复制一坑

正确:
CREATE TABLE `chapter_lock_reason` (
`id` INT(11) NOT NULL AUTO_INCREMENT
PRIMARY KEY (`id`)
);

错误的方式:
CREATE TABLE xxx.`chapter_lock_reason` (
`id` INT(11) NOT NULL AUTO_INCREMENT
PRIMARY KEY (`id`)
);

MySQL ARCHIVE 引擎,从库突然Can’t write; duplicate key in table ‘nopay_record” on query.

这是ARCHIVE引擎的BUG

Error ‘Can’t write; duplicate key in table ‘nopay_record” on query. Default database: ‘doufu’. Query: ‘insert into `nopay_record` (`user_id`, `novel_id`, `chapter_id`, `channel`, `created_at`) values (3927416, 365027, 2499984, NULL, ‘2017-12-29 23:38:01′)’

表结构:

CREATE TABLE `nopay_record` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`novel_id` int(11) NOT NULL,
`chapter_id` int(11) NOT NULL,
`channel` tinyint(4) DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT ‘0000-00-00 00:00:00’,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=ARCHIVE AUTO_INCREMENT=440357 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;

改成innodb

pecl update mongodb 1.1.* to 1.2.* 导致 php-fpm 全部立即段错误并失去控制,systemctl restart php-fpm失败

第二次遇到了~
ps -ef | grep php-fpm | cut -c 9-15 | xargs kill && systemctl restart php-fpm


Dec 15 20:40:02 web4 systemd: Removed slice User Slice of root.
Dec 15 20:40:02 web4 systemd: Stopping User Slice of root.
Dec 15 20:40:25 web4 kernel: traps: php-fpm[10171] general protection ip:7f4046d83120 sp:7ffc76043de0 error:0 in mongodb.so[7f4046d57000+be000]
Dec 15 20:40:25 web4 kernel: traps: php-fpm[1770] general protection ip:7f4054402542 sp:7ffc76045578 error:0 in ld-2.17.so[7f40543e9000+21000]
Dec 15 20:40:25 web4 kernel: traps: php-fpm[1771] general protection ip:7f4054402542 sp:7ffc76045578 error:0 in ld-2.17.so[7f40543e9000+21000]
Dec 15 20:40:25 web4 kernel: traps: php-fpm[1772] general protection ip:7f4054402542 sp:7ffc76045578 error:0 in ld-2.17.so[7f40543e9000+21000]
Dec 15 20:40:25 web4 kernel: traps: php-fpm[1773] general protection ip:7f4054402542 sp:7ffc76045578 error:0 in ld-2.17.so[7f40543e9000+21000]
Dec 15 20:40:25 web4 kernel: traps: php-fpm[1774] general protection ip:7f4054402542 sp:7ffc76045578 error:0 in ld-2.17.so[7f40543e9000+21000]
Dec 15 20:40:25 web4 kernel: traps: php-fpm[1775] general protection ip:7f4054402542 sp:7ffc76045578 error:0 in ld-2.17.so[7f40543e9000+21000]
Dec 15 20:40:25 web4 kernel: traps: php-fpm[1776] general protection ip:7f4054402542 sp:7ffc76045578 error:0 in ld-2.17.so[7f40543e9000+21000]
Dec 15 20:40:25 web4 kernel: traps: php-fpm[1777] general protection ip:7f4054402542 sp:7ffc76045578 error:0 in ld-2.17.so[7f40543e9000+21000]
Dec 15 20:40:25 web4 kernel: traps: php-fpm[1778] general protection ip:7f4054402542 sp:7ffc76045578 error:0 in ld-2.17.so[7f40543e9000+21000]
Dec 15 20:40:26 web4 systemd: Stopping LSB: starts php-fpm...