Hugh's Blog

生成 Chrome 可信任的自签名证书

生成的证书需要安装在本机信任机构列表中。 # 生成CA # openssl rand -writerand ~/.rnd openssl genrsa -out ca.key 4096 openssl req -new -x509 -days 365 -key ca.key -subj "/C=CN/ST=GD/L=GZ/O=Test/CN=root" -out ca.crt # 生成CSR文件 openssl req -newkey rsa:4096 -nodes -keyout server.key -subj "/C=CN/ST=GD/L=GZ/O=Test/CN=*.example.com" -out server.csr # 根据C ...

 

Linux 安装 PHP

Linux 选择安装特定 PHP 版本,做个记录。 CentOS 安装 PHP 安装源: # centos 7 yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm # centos 6 # yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm # yum install http://rpms.remirepo.net/enterprise/remi-release-6.rpm 安装 PHP: # yum 命令包 yum install yum-utils # 可以选择版本 # yum-config-manager --enable remi-php55 [Install ...

 

PHP 转换编码带 BOM 的问题

PHP 在转换文件编码时,如果遇到带有 BOM 头的话,会导致其他应用读取到的内容出现乱码,需要做单独的处理。 $content = file_get_contents('in.txt'); $encode = mb_detect_encoding($content, ['ASCII', 'GBK', 'GB2312', 'BIG5', 'UTF-8']); if ($encode !== 'UTF-8') { $content = iconv($encode, 'UTF-8', $content); } ...

 

CentOS 6.9 下编译安装 httpd2.4 及 PHP5.6

服务器环境为 CentOS 6.9,在 docker 中测试: docker pull centos:6.9 docker run -d -it --name centos-69 -p 18880:80 -p 18443:443 centos:6.9 bash docker exec -it centos-69 bash 进入到测试环境中: yum update # service 命令可能会缺失 yum install initscripts httpd 2.4 编译 # 查看当前安 ...

MySQL 组合索引使用

关于组合索引的使用,作个记录。 组合索引是指一个索引中包含多个列,当查询条件包含多个列时,需要注意左前缀原则,即查询的条件需要严格按照索引列的 ...

 
Older Posts >>