1. Install Xdebug

To use Xdebug with PhpStorm for debugging PHP applications, you need to have a PHP development environment configured with Xdebug extension installed. This task is beyond PhpStorm’s control. More information on configuring PHP development environment can be found in our web help.

Make sure that you have Xdebug installed properly. Please note that your Xdebug version should fit the PHP version you have (mind the PHP version number and thread-safe/non-thread-safe option) and installed as zend_extension. Don’t forget to set the xdebug.remote_enable setting to 1 in php.ini file. Detailed information on installing and configuring Xdebug can be found here. You can download the latest version of the Xdebug plugin at its official website. Recommended stable versions are 2.2.1 or 2.1.3.

You can check the configuration by executing php --version in the terminal

Alternatively, execute a page with phpinfo(); PHP function and make sure that you have Xdebug extension enabled. The xdebug section of the document with the installed version should be available.

2. Prepare PhpStorm

Toggle the “Start Listening for PHP Debug Connections” button. Don’t use any run configurations.

Once you've installed and configured Xdebug, you can use the Validating Your Debugging Configuration tool to confirm that the configuration of Xdebug and PhpStorm are compatible.

3. Set a breakpoint in the source code

Apart from setting the breakpoint manually, you can use the option Run | Break at first line in PHP scripts to have an automatic breakpoint at the first line of every PHP script you debug.

4. Activate debugger on server

In order to activate the debugger, you need to set a special GET/POST or COOKIE parameter (click here for details). You can do it manually, but it is much more convenient to use one a special tool such as browser toolbar or bookmarklet for that.

Try our PhpStorm bookmarklets generator and get bookmarklets which will work in any modern browser and allow you to start/stop a debugging session by controlling the Xdebug cookie.

 How to add "Start/Stop Debugging" bookmarklets to your browser bookmarks toolbar

5. Start a debug session in browser

6. Reload the current page

7. Set initial path mappings

Switch to PhpStorm; you'll see the Incoming Connection From Xdebug dialogue. You'll now need to select the path mappings so that PhpStorm can map the remote files on the web server to the local files in your project. If you have a deployment configured, then PhpStorm will offer to configure the mappings based on the paths you've already set in that deployment.

If you have no deployment configured (or if the file mappings in the deployment are different), then you can select a manual file to use for this incoming debugger session.

8. Debug!

After reaching the breakpoint the debugger is suspended. Now let’s investigate the application.

Troubleshooting

The first thing to check is that the Xdebug configuration is compatible with PhpStorm's configuration, you can do that using the Validating Your Debugging Configuration tutorial.

In some cases you may get the error message “Remote file path ‘path/to/script/on/the/server.php’ is not mapped to any file path in project“ or “The script ‘path/to/script/on/the/server.php’ is outside the project.” This means that PhpStorm is not sure which local file corresponds to the specified remote file path.

You can solve this problem quickly. Just set up the necessary path mappings by clicking the relevant link.

参考:https://confluence.jetbrains.com/display/PhpStorm/Zero-configuration+Web+Application+Debugging+with+Xdebug+and+PhpStorm

ero-configuration Web Application Debugging with Xdebug and PhpStorm的更多相关文章

  1. php Debugging with Xdebug and Sublime Text 3(转)

    Debugging – we all do it a lot. Writing code perfectly the first time around is hard and only a few ...

  2. Web.config Transformation Syntax for Web Application Project Deployment

    Web.config Transformation Syntax for Web Application Project Deployment Other Versions   Updated: Ma ...

  3. How to: Set Properties of Web Application Projects

    https://msdn.microsoft.com/library/aa983454(v=vs.100).aspx ASP.NET Web application projects share th ...

  4. Intellij Idea中的Jetty报出Web application not found src/main/webapp错误的解决方案

    今天在Intellij Idea中编译项目的时候,运行起来一直会报出如下的错误: Web application not found src/main/webapp 当时感觉应该是什么文件缺少了.所以 ...

  5. ModSecurity web application firewall (WAF) Research

    catalog . 引言 . OWASP ModSecurity Core Rule Set (CRS) Project . Installation mod_security for Apache ...

  6. Tomcat 开发web项目报Illegal access: this web application instance has been stopped already. Could not load [org.apache.commons.pool.impl.CursorableLinkedList$Cursor]. 错误

    开发Java web项目,在tomcat运行后报如下错误: Illegal access: this web application instance has been stopped already ...

  7. 转:Transform Web.Config when Deploying a Web Application Project

    Introduction One of the really cool features that are integrated with Visual Studio 2010 is Web.Conf ...

  8. 项目跑起来之后,一会儿后台就会报错Illegal access: this web application instance has been stopped already. Could not load [com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask]. The following stack trace

    一月 24, 2016 6:42:54 下午 org.apache.catalina.loader.WebappClassLoaderBase checkStateForResourceLoading ...

  9. this web application instance has been stopped already解决办法

    重启tomcat的时候出错 Illegal access: this web application instance has been stopped already.  Could not loa ...

随机推荐

  1. [洛谷P1063][NOIP2006]能量项链

    区间DP模板题 题目描述 在Mars星球上,每个Mars人都随身佩带着一串能量项链.在项链上有N颗能量珠.能量珠是一颗有头标记与尾标记的珠子,这些标记对应着某个正整数.并且,对于相邻的两颗珠子,前一颗 ...

  2. python数据结构之选择排序

    选择排序(select_sort)是一个基础排序,它主要通过查找已给序列中的元素的最大或者最小元素,然后将其放在序列的起始位置或者结束位置,并通过多次这样的循环完成对已知序列的排序,在我们对n个元素进 ...

  3. IE和DOM事件流

    * ie采用冒泡型事件 Netscape使用捕获型事件 dom使用先冒泡后捕获事件 冒泡型事件模型: button->div->body (IE事件流) 捕获型事件模型: body-> ...

  4. luffy项目的接口开发

    处理跨域请求 主要的思路: 设置一个基于CORS的中间件来处理,关于跨域的产生与处理手段 settings.py: MIDDLEWARE = [ 'django.middleware.security ...

  5. BZOJ4432 : [Cerc2015]Greenhouse Growth

    对于高度相同的一段可以合并,用链表从左往右维护这些连续段,每段维护以下信息: $l,r$:表示区间的左右端点. $t,a$:表示在第$t$天结束时它的高度是$a$. $b$:当阳光在左边时它是否会长高 ...

  6. redis(四)

    hash hash用于存储对象,对象的格式为键值对 命令 设置 设置单个属性 HSET key field value 设置多个属性 HMSET key field value [field valu ...

  7. jemter模拟高并发访问(亲测ok)

    https://blog.csdn.net/a574258039/article/details/19549407

  8. redis配置(redis.conf)

    1.如果我们刚刚装好 redis 发现Redis Desktop Manager无法连接到redis,       那是因为redis默认配置只让本机访问,我们 vim redis.conf 注释以下 ...

  9. windows安装并使用Anaconda

    前言 本意是要使用Jupyter(Jupyter官网地址),在Jupyter官网上看到,强烈建议新手使用Anaconda,于是开始下载Anaconda使用.Anaconda是用于管理开源包(packa ...

  10. c语言单片机中断服务程序

    #include <reg52.h> #define uchar unsigned char #define uint unsigned int uint count; void dela ...