安装 PhpStorm+Xdebug+LNMP 调试环境 
                            
                                                    
                        
                    
                    
  
                    
                    前阵子在Mac上安装了LNMP开发环境,这两天在开发调试php程序的时候,发现用echo、printf或var_dump等函数调试程序异常的麻烦,所以就想使用xdebug进行程序调试,网上的很多资料都比较的陈旧,现整理一下集成phpstorm+xdebug的步骤
1. 安装xdebug
由于使用的是Mac进行开发,所以就使用Homewbrew进行软件包的管理
// 安装php版本相对应的xdebug拓展
$  brew install php70-xdebug2. 配置xdebug
使用brew进行软件包的安装的话,配置文件路径为:/usr/local/etc/php/7.0/conf.d/ext-xdebug.ini
[xdebug]
zend_extension="/usr/local/opt/php70-xdebug/xdebug.so"
;是否开启远程调试自动启动
xdebug.remote_autostart = On
;是否开启远程调试
xdebug.remote_enable = On
;允许调试的客户端IP
xdebug.remote_host=localhost
;远程调试的端口(默认9000)
xdebug.remote_port=9000
;调试插件dbgp
xdebug.remote_handler=dbgp
;是否收集变量
xdebug.collect_vars = On
;是否收集返回值
xdebug.collect_return = On
;是否收集参数
xdebug.collect_params = On
;是否开启调试内容
xdebug.profiler_enable=On
xdebug.idekey = PHPSTORM配置完之后,由于我使用的是nginx,所以需要重启php-fpm(假如使用的是Apache,则重启Apache服务器)
有两种方式可以检测xdebug是否加载成功
- 
phpinfo()  
- 
命令行输入php -m 
$  php -m
[PHP Modules]
bcmath
bz2
calendar
...
[Zend Modules]
Xdebug3. 配置phpstorm
先配置php使用的版本号
再配置web server
最后设置phpstorm监听xdebug的端口号,默认为9000
大功告成:beers:
           本帖已被设为精华帖!
        
      
                      本帖由系统于 7年前 自动加精
            
                 
           
         
             
             
             
             
             
             
             
             
             
             
             
             
                     
                     
           
           关于 LearnKu
                关于 LearnKu
               
                     
                     
                     粤公网安备 44030502004330号
 粤公网安备 44030502004330号 
 
推荐文章: