安装apxs

  • yiqingpeng
  • 2022-12-19
  • 0
  • apxs 
Apxs是用来安装apache模块的一个工具,FreeBSD系统的apache24自带apxs,不需要单独安装。 下面介绍其它系统的安装方法。 CentOS/Fedora # dnf install httpd-devel  # or yum install httpd-devel Ubun

输出重定向没有sudo权限的问题

利用sudo我们可以越权执行命令,考虑如下命令 user@xxx:~$ sudo -u root xxxxx.sh >> /var/log/sample.log 如果user用户对日志文件/var/log/sample.log没有写入权限(前提是user具有了sudo权限), 那么此

缓存的三个问题:雪崩,击穿和穿透

雪崩:缓存大面积同时失效,大量请求在失效的时间点直接查询数据库,导致数据库垮掉。解决方法可以让缓存永久不失效而利用定时脚本进行缓存数据的刷新。或者缓存的失效时间设置为随机数。 穿透:请求的数据不在缓

Bash脚本中的-eq, =和==

  • yiqingpeng
  • 2022-04-11
  • 0
  •  
-eq 是用来比较数值的,如果是字符串,会转化为数值,所以 [ 'yes' -eq 0 ] 或 [[ 'yes' -eq 0 ]] 测试结果都为TRUE. = 单等号 和 == 双等号都是用来比较字符串的,它们放在[ ... ]和

Gearman服务管理及队列持久化

Gearman服务的管理,以及如何利用mysql持久化保存任务队列。

老是忘记在防火墙中开放某服务的端口

在CentOS7中安装了一些服务后,如果要能使外部连接使用,必须开放对应的端口。 比如:httpd(80, 443), ssh, mysql, memcached, gearmand, ftp, Elasticsearch等 相关的firewall操作如下: 开启指定端口

根据composer.lock修复composer.json

  • yiqingpeng
  • 2021-11-25
  • 0
  •  
有时候由于某些失误会将composer.json删除或者是编辑错误,导致composer.json丢失或者与vendor目录实际安装包不相符。此时就需要根据实际安装包来修复composer.json了。 幸好,有前辈编写了工具composer-recovery

Nodejs: http2之push示例

Node自8.4.0开始已经内置了http2模块,利用http2的特性可以将资源事先push给客户端。客户端收到push的资源会放在缓存里,当页面解析过程中遇到了相匹配的资源时,就会直接从缓存中获取,而不需要重新发起请求。 要

normalize CSS

  • yiqingpeng
  • 2021-08-22
  • 0
  •  
来源:https://necolas.github.io/normalize.css/  

AWS-S3 PHP API示例

  • yiqingpeng
  • 2021-03-01
  • 0
  •  
function s3upload($file){ global $s3, $bucket, $finfo; $result = $s3->putObject([ 'Body' => $file->content, 'Bucket' => $bucket, 'Key' => "di

Netsuite更新customField, 删除FileCabinet的文件, 高级搜索

//$service = new NetSuiteService(); class CustomRecordSearchAdvancedBuilder{ private static $instance; private $request; private $NSService; private $search; private $pageIn

css动画重置,暂停,监听结束

  • yiqingpeng
  • 2020-12-27
  • 0
  •  
<style> .animation{height:20px;background:green;animation:fancy1 20s} @keyframes fancy1{ 0%{width:0%;} 100%{width:100%;} } @keyframes fancy2{ 0%{width:0%;} 100%{width:100%;} } <

消除阻塞式资源(Eliminate render-blocking resources)

有以下两种URL资源会阻塞渲染: 1,放置在<head>中的<script>脚本引用,并且未设置defer或async属性。 2,<link rel="stylesheet">样式引用,并且未设置disabled或media属性。 处理阻塞式资

Resize images on server side

  • yiqingpeng
  • 2020-12-14
  • 0
  •  
Nodejs使用sharp库: const sharp = require('sharp'); const fs = require('fs'); const directory = './images'; fs.readdirSync(directory).forEach(file => {   sharp(`${directory}/${f

The problems with long running php scripts

  • yiqingpeng
  • 2020-11-04
  • 0
  •  
Writing a daemon in PHP can be a very attractive prospect. You already have your website written, so you have all of this great code already. You just need it to run and keep track of some data or han

Mysql开启日志记录

  • yiqingpeng
  • 2020-11-04
  • 0
  •  
vim /etc/my.conf.d/server.cnf: #lower_case_tables_name = 1 slow_query_log='ON' slow_query_log_file='/mnt/lnx_log/mysql/slow.log' long_query_time=1 general_log='ON' general_log_f

About HTTP chunked AND gzip

  • yiqingpeng
  • 2020-10-31
  • 0
  •  
Chunked transfer encoding allows a server to maintain an HTTP persistent connection for dynamically generated content. In this case the HTTP Content-Length header cannot be used

Mysql中一条sql到底能写多长?

  • yiqingpeng
  • 2020-10-31
  • 0
  •  
先看来https://php.golaravel.com/mysqli.query.html中的一段话: where you pass a statement to mysqli_query() that is longer than max_allowed_packet of the server, the returned er

Buffered and Unbuffered queries

  • yiqingpeng
  • 2020-10-31
  • 0
  •  
使用PHP的mysql API从mysql获取超大数据集,比如几百万行的记录,如果使用默认的配置,往往会因为客户端的内存不足而失败。话不多说,直接抄官方的说明。 Queries are using the buffered mode by de

PHP用户输出缓冲区的理解

  • yiqingpeng
  • 2020-10-29
  • 0
  •  
PHP的用户输出缓冲区,它通过调用ob_start()创建,我们可以创建很多这种缓冲区(至到内存耗尽为止),这些缓冲区组成一个堆栈结构,每个新建缓冲区都会堆叠到之前的缓冲区上,每当它被填满或者溢出,都会执行刷新操作