Skip to content

快速搭建PHP代码审计环境,支持使用 PHPStorm 进行调试。

Notifications You must be signed in to change notification settings

N0el4kLs/php_aduit_docker-compose

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP代码审计环境-Docker-compose

介绍

快速搭建PHP代码审计环境,支持使用 PHPStorm 进行调试。支持单/多套源码同时部署,只需要简单配置下Nginx即可。

使用案例,可以参考我的博客:使用docker-compose快速搭建PHP代码审计环境

Nginx Location 配置示例

# 配置 /path_prefix 路径的处理规则
location /path_prefix {
    # 将请求映射到实际的目录,注意最后的斜杠不能省略
    alias /var/www/html/your_path/;
    
    # 设置默认索引文件
    index index.php index.html index.htm;
    
    # 路由重写规则:依次尝试访问 $uri,$uri/,如果都不存在则重写到 index.php
    try_files $uri $uri/ /app1/index.php?$query_string;

    # 处理 PHP 文件, 下面的配置默认不需要修改
    location ~ \.php$ {
        fastcgi_pass php:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $request_filename;
        include fastcgi_params;
    }
}

PHPStorm 调试配置

1. 检查Xdebug

设置->PHP->Debug中,使用validate查看Debug是否成功。

image-20250123144450642

image-20250123144654643

从显示信息中,可以看到端口为9003,设置Debug port:

image-20250123145026183

2. 配置DBGp Proxy

Port和上面同步,其他地方照抄就行。

image-20250123145119401

3.调试

设置完之后,打开xdebug ,下断点调试就行了

image-20250123145631297

4.配置目录映射(可选)

如果配置好后,第一次调试没有出现目录映射相关的信息,就手动映射一下

image-20240107214505729

关于部分时候断点调试捕获不了的问题:

临时解决方案:在 Setting----->PHP---->servers 处的映射路径多填写一点.具体原因还在排查.

image-20240206223806410

About

快速搭建PHP代码审计环境,支持使用 PHPStorm 进行调试。

Resources

Stars

Watchers

Forks