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. Django 学习第三天——模板变量及模板过滤器

    一.模板路径的查找: 查找顺序:(现在哪找到就用那个) 首先在主目录的 setting.py 文件里的 TEMPLATES 中的 DIRS 里找: 其次如果 DIRS 中的 APP_DIRS : 'T ...

  2. Linux 系统分级及root权限相关

    单用户模式修改用户密码 救援模式 让我们先来了解一下linux的运行步骤 1. Linux系统引导的顺序掌握Linux系统引导的顺序:BIOSMBRKernelinit其中,BIOS的工作是检查计算机 ...

  3. Maya插件开发的几种方式归纳

    目前仅仅是一时兴趣,想要探索一下Maya插件开发的具体方法,但因为没有时间所以只起了个头 首先来到Autodesk Developer Network http://usa.autodesk.com/ ...

  4. BZOJ.4199.[NOI2015]品酒大会(后缀自动机 树形DP)

    BZOJ 洛谷 后缀数组做法. 洛谷上SAM比SA慢...BZOJ SAM却能快近一倍... 只考虑求极长相同子串,即所有后缀之间的LCP. 而后缀的LCP在后缀树的LCA处.同差异这道题,在每个点处 ...

  5. malloc函数详解 C语言逻辑运算符

    今天写线性表的实现,又遇到了很多的难题,C语言的指针真的没学扎实.很多基础都忘了. 一是 :malloc 函数的使用. 二是:C语言逻辑运算符. 一.原型:extern void *malloc(un ...

  6. [JOISC2014]たのしい家庭菜園

    [JOISC2014]たのしい家庭菜園 题目大意: 给定一个长度为\(n(n\le3\times10^5)\)的序列\(A(A_i\le10^9)\).只能交换相邻两个数,问最少需要几步可以将它变成一 ...

  7. Vue.js的初步使用

    1.声明式渲染 <!DOCTYPE html> <html lang="en"> <head> <meta charset="U ...

  8. [P1020]导弹拦截 (贪心/DP/二分/单调队列)

    一道很经典的题 这道题就是要求一个最长单调不升子序列和一个最长单调上升子序列. 先打了一个n2复杂度的 用DP #include<bits/stdc++.h> using namespac ...

  9. 元素 "context:component-scan" 的前缀 "context" 未绑定。

    是因为没有导入context的命名空间

  10. php 数组模糊匹配

    php 数组模糊匹配: $list = array(); // 匹配后的结果 $arr = array("abcd","abef","efgh&quo ...