企业🤖AI Agent构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
## 一、远程服务器安装Xdebug 1、安装; ``` wget https://xdebug.org/files/xdebug-2.9.8.tgz tar -xzf xdebug-2.9.8.tgz cd xdebug-2.9.8 /usr/local/php/bin/phpize ./configure --enable-xdebug --with-php-config=/usr/local/php/bin/php-config make && make install ``` ![](https://img.kancloud.cn/1e/83/1e830fc18893ae913d7aceed2202f3dd_924x502.png) 2、配置; 修改php.ini文件,在后面追加; ``` [Xdebug] zend_extension="/usr/local/php/lib/php/extensions/no-debug-non-zts-20170718/xdebug.so" xdebug.profiler_enable=on xdebug.trace_output_dir="/usr/xdebug-tmp" xdebug.profiler_output_dir="/usr/xdebug-tmp" xdebug.remote_enable=on xdebug.remote_handle=dbgp xdebug.remote_host=211.149.136.6 xdebug.remote_port=9008 ``` >[danger] 注意: >1、xdebug.trace_output_dir和xdebug.profiler_output_dir需要增加权限; mkdir /usr/xdebug-tmp chmod 755 /usr/xdebug-tmp >2、xdebug.remote_host是当前配置的运行IDE的调试本地主机IP,xdebug.remote_port是当前配置的运行IDE的调试监控端口; >3、xdebug开启的端口,需要注意防火墙需要打开; 3、重启php-fpm,确保xdebug已经正确安装; ![](https://img.kancloud.cn/2d/5a/2d5aa33d1b4fdf8e920b527222598943_1089x655.png) ## 二、配置IDE 1、配置调试 ![](https://img.kancloud.cn/0d/b1/0db11cebf0391fa9ef05cb6a5778d7e7_766x673.png) 2、创建项目 ![](https://img.kancloud.cn/e3/f9/e3f92a1f8f232a54b5bfa0d97928f4c7_737x508.png) ![](https://img.kancloud.cn/1f/c3/1fc3db416996ff145bacd03af6763928_847x508.png) 设置链接远程项目的方式: ![](https://img.kancloud.cn/13/13/1313c760f84aa188cb2fbc6e214759cf_692x530.png) ![](https://img.kancloud.cn/53/db/53dbb9fc8ce13e8a90c37c7436b397f7_847x508.png) ftp的目录,根目录必须指向部署的php工程根目录; ![](https://img.kancloud.cn/a8/10/a810bd63a918733c1f61720334b5d71e_847x508.png) ![](https://img.kancloud.cn/5e/94/5e94f576d956540f67cbff8bbebef86b_799x508.png) ![](https://img.kancloud.cn/f4/84/f484b39ca77db44945f25b59bab870e9_799x508.png) 3、开始调试 到这里,就跟本地测试一样了; ![](https://img.kancloud.cn/e7/78/e778db537270f22f2f5e4f85fd0a5da8_1357x602.png) 特别注意:本机有可能无法正常调试,需要一台有公网IP的云主机,否则可能本机的IP是动态IP,导致无法从远程主机与本机通讯导致失败;