php个人博客 - php笔记 / zh-CN php个人博客,记录日常代码,服务器维护,分享开源学习资源,好看模板,快速建站 Tue, 27 Oct 2022 11:20:31 +0800 Tue, 27 Oct 2022 11:20:31 +0800 iftop查看服务器带宽占用情况 /archives/43.html /archives/43.html Tue, 27 Oct 2022 11:20:31 +0800 hkch https://www.cnblogs.com/chenqionghe/p/10680075.html

]]>
3 /archives/43.html#comments /feed/archives/43.html
定时清理nginx日志 /archives/42.html /archives/42.html Tue, 20 Oct 2022 16:37:53 +0800 hkch find /home/wwwlogs/ -mtime +7 -type f -name \*.log | xargs rm -f ]]> 0 /archives/42.html#comments /feed/archives/42.html mysql like查询 /archives/41.html /archives/41.html Wed, 19 Aug 2022 11:45:12 +0800 hkch https://www.jianshu.com/p/b6663510c60c

]]>
0 /archives/41.html#comments /feed/archives/41.html
Thinkphp5性能优化 /archives/40.html /archives/40.html Tue, 14 Jul 2022 22:04:57 +0800 hkch 参考官方建议:
https://blog.thinkphp.cn/843679

]]>
0 /archives/40.html#comments /feed/archives/40.html
推荐PHP笔记,覆盖内容挺多 /archives/39.html /archives/39.html Tue, 23 Jun 2022 21:00:39 +0800 hkch 偶然翻到作者的内容,详细看里下目录,写的东西挺多,知识点很多,值得深入学习
https://www.kancloud.cn/xiak/php-node/379420

]]>
1 /archives/39.html#comments /feed/archives/39.html
MacOS上搭建THinkPHP开发环境 /archives/38.html /archives/38.html Tue, 23 Jun 2022 19:45:01 +0800 hkch
  • PHP
    MacOS 自带了 PHP,无需安装。
  • php -v
    
    1. composer
      安装
    php -r "copy('https://install.phpcomposer.com/installer', 'composer-setup.php');"

    执行安装过程

    php composer-setup.php

    删除安装脚本

    php -r "unlink('composer-setup.php');"

    全局安装

    sudo mv composer.phar /usr/local/bin/composer

    切换镜像

    composer config -g repo.packagist composer https://packagist.phpcomposer.com
    
    1. ThinkPHP
      使用composer安装thinkphp
    composer create-project topthink/think tp

    启动 web 服务

    cd tp
    php think run

    访问http://127.0.0.1:8000即可看到TP首页

    1. MySQL
      使用docker安装mysql,建议使用5.7版本,不要使用8,8用navacate连接的时候会报连接错误,我这边按照网上说的修改密码也没管用,最后使用5.7版本就好了
    docker pull mysql:5.7
    

    运行 MySQL 容器

    docker run -d --name mysql -e MYSQL_ROOT_PASSWORD=123456 -p 3306:3306 mysql:5.7

    连接 MySQL 服务
    上面 docker run 的命令执行后,数据库服务就已经运行完成了,使用 docker ps 命令即可看到正在运行的 mysql 容器。

    连接mysql时使用的时docker里的ip,查看ip命令

    ifconfig | grep inet
    ]]>
    0 /archives/38.html#comments /feed/archives/38.html
    Thinkphp6查询漏洞 /archives/37.html /archives/37.html Thu, 18 Jun 2022 14:08:42 +0800 hkch 使用原生sql拼接查询时,如果不处理输入的内容会有注入漏洞,用sqlmap可注入
    比如:
    $sql='search='.$search;
    Db::name('table')->where($sql)->select();
    要杜绝这种写入,使用参数绑定或者数组的方式查询
    一旦用sqlmap扫出漏洞,那数据全部内容就都暴露了,如果服务器再有漏洞,那可以直接拿到服务器权限了

    ]]>
    0 /archives/37.html#comments /feed/archives/37.html
    SQLMap使用方法及技巧分享 /archives/36.html /archives/36.html Thu, 18 Jun 2022 13:42:10 +0800 hkch sqlmap是一个开源的渗透测试工具,可以用来进行自动化检测,利用SQL注入漏洞,获取数据库服务器的权限。它具有功能强大的检测引擎,针对各种不同类型数据库的渗透测试的功能选项,包括获取数据库中存储的数据,访问操作系统文件甚至可以通过外带数据连接的方式执行操作系统命令。

    官方网站:http://sqlmap.org/

    下载地址:https://github.com/sqlmapproject/sqlmap/zipball/master

    演示视频:https://asciinema.org/a/46601

    教程:http://www.youtube.com/user/inquisb/videos

    详细信息:https://www.freebuf.com/sectool/164608.html

    ]]>
    0 /archives/36.html#comments /feed/archives/36.html
    centos服务器执行超时任务504,调整最大执行时间 /archives/35.html /archives/35.html Sat, 13 Jun 2022 23:20:13 +0800 hkch centos服务器执行超时任务504,调整最大执行时间
    常规操作
    修改php.ini中max_excution_time
    修改php-fpm.conf中request_terminate_timeout = 160
    修改nginx.conf

        keepalive_timeout 260;
        fastcgi_connect_timeout 600;
        fastcgi_send_timeout 600;
        fastcgi_read_timeout 600;
    send_timeout 300s;

    以上设置都修改过还是不生效
    最后发现使用了阿里的cdn
    再cdn中需要设置
    cdn=》域名设置=》回源设置=》回源请求超时设置

    ]]>
    0 /archives/35.html#comments /feed/archives/35.html
    跨域问题服务端的配置记录 /archives/34.html /archives/34.html Thu, 11 Jun 2022 10:09:00 +0800 hkch 场景:多个项目使用一个主域名,一些公共的部分会遇到跨域问题
    服务器配置:
    1,nginx:

    set $cors_origin "";
    if ($http_origin ~* "^https://w.phpbiji.com$") {
            set $cors_origin $http_origin;
    }
    if ($http_origin ~* "^https://f.phpbiji.com$") {
            set $cors_origin $http_origin;
    }
    
    add_header Access-Control-Allow-Origin $cors_origin;
    add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS';
    add_header Access-Control-Allow-Credentials true;
    add_header Access-Control-Allow-Headers 'Cookie,DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';
    

    2,apache

    SetEnvIf Origin "http://192\.168\.1\.111:8081|http://f\.phpbiji\.com:8080|http://a\.phpbiji\.com:8081|http://b\.phpbiji\.com:8082$" AccessControlAllowOrigin=$0$1
    Header set Access-Control-Allow-Origin %{AccessControlAllowOrigin}e env=AccessControlAllowOrigin
    Header set Access-Control-Allow-Credentials true
    
    ]]>
    0 /archives/34.html#comments /feed/archives/34.html