XAMPP + PhpStorm + Xdebug本地实验环境搭建
参考:
下载合适的XDebug
点击这里,选择合适xdebug

XAMPP配置
php_xdebug-xxxx.dll
拷贝dll至 D:\XAMPP\php\ext
php.ini
文末追加
[XDebug]
zend_extension = "D:\XAMPP\php\ext\php_xdebug-2.7.0RC2-7.3-vc15.dll"
xdebug.profiler_append =
xdebug.profiler_enable =
xdebug.profiler_enable_trigger =
xdebug.profiler_output_dir = "d:\xampp\tmp"
;xdebug.profiler_output_name = "cachegrind.out.%t-%s"
xdebug.remote_enable =
xdebug.remote_handler = "dbgp"
xdebug.remote_host = "127.0.0.1"
xdebug.remote_log="d:\xampp\tmp\xdebug.txt"
xdebug.remote_port =
xdebug.trace_output_dir = "d:\xampp\tmp"
; ( hour), = 10h
xdebug.remote_cookie_expire_time =
xdebug.idekey="PhpStorm"
Stop/Start Apache

检查xdebug是否安装成功
方法1:运行 http://localhost/dashboard/phpinfo.php 并检查xdebug
方法2:php -m 并检查xdebug

PHPStorm配置
xdebug相应配置
- 打开phpStorm,进入File>Settings>PHP>Servers,这里要填写服务器端的相关信息,name填localhost,host填localhost,port填80,debugger选XDebug
- 进入File>Settings>PHP>Debug,看到XDebug选项卡,port填9000,其他默认
- 进入File>Settings>PHP>Debug>DBGp Proxy,IDE key 填 PHPSTORM,host 填localhost,port 填80
- 点OK退出设置
PHPstorm项目配置
指定PHP intepreter

指定项目部署位置

浏览器配置
在适当浏览器上安装插件,这里
- easiest Xdebug for Firefox:这个扩展是Firefox上用于使得与IDE一起调试起来更加容易。你可以在https://addons.mozilla.org/en-US/firefox/addon/the-easiest-xdebug/上找到这个扩展.
- Xdebug Helper for Chrome:这个扩展是运行在Chrome浏览器上的,它将会帮助你通过点击一下按钮就可以允许/禁止调试和性能分析。你可以在https://chrome.google.com/extensions/detail/eadndfjplgieldjbigjakmdgkmoaaaoc找到这个扩展.
- Xdebug Toggler for Safari:这个扩展是运行在Safari上的,允许你在Safari中自动的开始Xdebug调试过程,你可以在Github上找到这个扩展https://github.com/benmatselby/xdebug-toggler.
- Xdebug launcher for Opera:这个扩展是运行在Opera上的,它允许你在Xdebug上开启一个Xdebug会话。
以Chrome为例,安装完插件后如图

测试xdebug
实验代码
orderform.html
<html>
<head><title>Bob's Auto Parts</title></head>
<body>
<form action="processorder.php" method="post">
<table border="0">
<tr bgcolor="#cccccc">
<td width="150">Item</td>
<td width="15">Quantity</td>
</tr>
<tr>
<td>Tires</td>
<td align="center"><input type="text" name="tireqty" size="3"
maxlength="3" /></td>
</tr>
<tr>
<td>Oil</td>
<td align="center"><input type="text" name="oilqty" size="3"
maxlength="3" /></td>
</tr>
<tr>
<td>Spark Plugs</td>
<td align="center"><input type="text" name="sparkqty" size="3"
maxlength="3" /></td>
</tr>
<tr>
<td>How did you find Bob's?</td>
<td><select name="find">
<option value = "a">I'm a regular customer</option>
<option value = "b">TV advertising</option>
<option value = "c">Phone directory</option>
<option value = "d">Word of mouth</option>
</select>
</td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" value="Submit Order" /></td>
</tr>
</table>
</form>
</body>
</html>
processorder.php
<html>
<head>
<title>Bob's Auto Parts - Order Results</title>
</head>
<body>
<h1>Bob's Auto Parts</h1>
<h2>Order Results</h2>
<?php
echo '<p>Order processed at ';
echo date('H:i, jS F');
echo '</p>';
echo '<p>Your order is as follows: </p>';
echo $tireqty.' tires<br />';
echo $oilqty.' bottles of oil<br />';
echo $sparkqty.' spark plugs<br />'; $totalqty = 0;
$totalamount = 0.00; $totalqty = 0;
$totalqty = $tireqty + $oilqty + $sparkqty;
echo 'Items ordered: '.$totalqty.'<br />'; $totalamount = 0.00; define('TIREPRICE', 100);
define('OILPRICE', 10);
define('SPARKPRICE', 4); $totalamount = $tireqty * TIREPRICE
+ $oilqty * OILPRICE
+ $sparkqty * SPARKPRICE; echo 'Subtotal: $'.number_format($totalamount,2).'<br />'; $taxrate = 0.10; // local sales tax is 10%
$totalamount = $totalamount * (1 + $taxrate);
echo 'Total including tax: $'.number_format($totalamount,2).'<br />'; ?>
</body>
</html>
调试演示
在PHP中打断点,浏览器触发断点

XAMPP + PhpStorm + Xdebug本地实验环境搭建的更多相关文章
- PhpStorm Xdebug远程调试环境搭建原理分析及问题排查
2017年05月26日 经验心得 目录 一. 环境介绍 二. 远程环境配置 2.2 Xdebug安装 2.3 配置 三. 本地phpstorm配置 3.1 下载远程代码 3.2 添加php解释器 ...
- 论持久战之PHPStorm Xdebug Remote 调试环境搭建(不依赖本地环境)
最近公司自己搭建了一个资源管理平台,哈哈,当然是我在github上找的,后台用PHP开发.个人觉得写得非常nice,web页面几乎模拟了真实OS,有兴趣的朋友下载部署体验https://github. ...
- [xDebug] PhpStorm Xdebug远程调试环境搭建
对于简单的工程,直接print_r();exit()已经足够,但是对于大型项目有时就有点力不从心.. 1,环境介绍 本地:windows10(192.168..)+ phpstorm8远程:Cento ...
- centos7+nginx 1.9.0+php-fpm+phpstorm+xdebug+vmware开发环境搭建
1.php-fpm yum install php-fpm 默认配置在本地9000端口监听 service php-fpm restart启动 2.nginx 1.9.0 需先安装gcc zlib o ...
- LVS本地实验环境搭建
文中实验需要使用以下软件: CentOS的镜像 Virtual Box GNS3 0.实验前的准备工作 0.1.修改yum源 为了方便安装软件,我们设置yum源为公司yum源 1.直接复制公司机器上的 ...
- 本地环境 XAMPP+phpStorm+XDebug+chrome配置和断点调试 注册方法
我的安装环境:XAMPP版本号V3.1.0 ;phpStorm版本8.0.3;windowsxp 32bit.您老人家先过目一下,不然怕影响意义. XAMPP.phpStorm 都直接安装在了D盘根目 ...
- https,https的本地测试环境搭建,asp.net结合https的代码实现,http网站转换成https网站之后遇到的问题
一:什么是https SSL(Security Socket Layer)全称是加密套接字协议层,它位于HTTP协议层和TCP协议层之间,用于建立用户与服务器之间的加密通信,确保所传递信息的安 ...
- 【转】https,https的本地测试环境搭建,asp.net结合https的代码实现,http网站转换成https网站之后遇到的问题
正需要这个,写的很好,就转过来了 转自: http://www.cnblogs.com/naniannayue/ 一:什么是https SSL(Security Socket Layer)全称 ...
- 操作系统内核Hack:(一)实验环境搭建
操作系统内核Hack:(一)实验环境搭建 三四年前,心血来潮,入手<Orange's:一个操作系统的实现>学习操作系统内核,还配套买了王爽的<汇编语言(第二版)>和<80 ...
随机推荐
- Superset配置mysql数据源
1.添加mysql数据源 测试连接的时候遇到 No module named 'MySQLdb'" 安装mysqlclient pip install mysqlclient 如果遇到 ER ...
- C++内存管理4-Windows编程中的堆管理(转)
1 引言 在大多数Windows应用程序设计中,都几乎不可避免的要对内存进行操作和管理.在进行大尺寸内存的动态分配时尤其显的重要.本文即主要对内存管理中的堆管理技术进行论述. 堆(Heap)实际是位于 ...
- IntelliJ IDEA Error:(24, 35) java: 常量字符串过长
在转换一个JSON转Java对象是 idea 编译不通过 提示:Error:(24, 35) java: 常量字符串过长 File -> Settings -> Build,Execut ...
- 湖南省第6届程序大赛第6题 Biggest Number
Problem F Biggest Number You have a maze with obstacles and non-zero digits in it: You can start fro ...
- javascript异步上传压缩图片并立即显示图片
javascript异步上传压缩图片并立即显示图片<pre><!doctype html><html><head><meta charset=&q ...
- ElasticSearch中"distinct","count"和"group by"的实现
最近在业务中需要使用ES来进行数据查询,在某些场景下需要对数据进行去重,以及去重后的统计.为了方便大家理解,特意从SQL角度,方便大家能够理解ES查询语句. 1 - distinct ; { &quo ...
- 处理html换行问题
String.prototype.replaceAll = function (FindText, RepText) { regExp = new RegExp(FindText, "g&q ...
- JDK本地内存追踪NMT
通常情况下, JVM占用的内存不仅仅是-Xmx, -Xms等指定的大小, 因为JVM也是一个应用, 它需要额外的空间去完成它的工作, 除了堆外, JVM会分配内存的地方包括以下这些: Metaspac ...
- 嵌入式02 STM32 实验11 NVIC和中断总结
一.基础知识 1.cortex-m3支持256个中断,其中包含了16个内核中断,240个外部中断 2.STM32只有84个中断,包括16个内核中断和68个可屏蔽中断 3.STM32F103上只有60个 ...
- 【LEETCODE】72、分割回文串 III 第1278题
package y2019.Algorithm.dynamicprogramming.hard; /** * @Auther: xiaof * @Date: 2019/12/11 08:59 * @D ...