ero-configuration Web Application Debugging with Xdebug and PhpStorm

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

时间: 2024-08-09 02:03:45

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

项目跑起来之后,一会儿后台就会报错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 信息: Illegal access: this web application instance has been stopped already. Could not load [com.mchange.v2.resourcepool.BasicResourcePool$1DestroyRes

ModSecurity web application firewall (WAF) Research

catalog 0. 引言 1. OWASP ModSecurity Core Rule Set (CRS) Project 2. Installation mod_security for Apache 3. Installation mod_security for nginx 4. Installation mod_security for IIS 5. mod_security Configuration Directives 6. Processing Phases 7. Variab

this web application instance has been stopped already

一台机器启动两个tomcat server.xml connector里面port换一个新端口,然后启动进程 启动不了,日志里面catalina.out里面总显示 Illegal access: this web application instance has been stopped already.  Could not load net.rubyeye.xmemcached.exception.UnknownCommandException.  The eventual followin

Example: Develop Web application on Baidu App Engine using CherryPy

In the past few months, I have developed two simple applications on Baidu App Engine. Compared to Google App Engine, or Nitrous.Io, the documentation of BAE is really not good enough. The only advantage of BAE is stable - you needn't to worry about G

OWASP(Open Web Application Security Project) Top 10 for JavaScript

Injection Injection flaws, such as SQL, OS, and LDAP injection, occur when untrusted data is sent to an interpreter as part of a command or query. The attacker's hostile data can trick the interpreter into executing unintended commands or accessing u

Tomcat启动时卡在“INFO: Deploying web application directory ......”的解决方法

转载地址:http://blog.csdn.net/njchenyi/article/details/46641141 第一次遇到Tomcat在Linux服务器启动卡住的情况,情况很简单,tomcat启动以后卡在INFO: Deploying web application directory ......这句话,具体会卡多久就没测试了.google.baidu都没找到解决方法. 幸亏UCloud的技术支持人员给出了解决方案. 找到jdk1.x.x_xx/jre/lib/security/Jav

java 远程调试(java application与web application)

如摘要中所述,在联调时经常性的需要将程序部署到测试机器上,此时要调试显得很不方便.以前的做法都是在程序中打印信息来进行追踪,但是这种方法很有局限性,因为往往无法一次就定位到有问题的地方,需要不断的修改程序打印的语句,不断的重启应用,这需要花费大量的时间和精力.因此,采用远程调试会是一种好的解决方式.下面将会对java application和web application两种入手进行说明. 一.Java Application的远程调试 1.准备要调试的server端环境 首先准备一段小的代码,

解决this web application instance has been stopped already

重启tomcat的时候出错 Illegal access: this web application instance has been stopped already.  Could not load oracle.net.mesg.Message.  The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate

Asp.net Web Application 打开 SharePoint 2010 Site 错误 The Web application at could not be found

解决办法如下: 1. 修改项目的.net framework 为3.5 2. Application Pool 选用 Sharepoint App pool 3. 修改 web.config如下: <?xml version="1.0"?> <configuration> <configSections> <sectionGroup name="system.web.extensions" type="System