本文介绍了如何使用Symfony命令行工具在内置Web服务器的PHPStorm中进行调试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我能够在PHPStorm中设置一个php web app调试器,只需将它绑定到我在特定端口的localhost即可,一切正常。但是为了工作,我需要先在shell上运行这个命令:

I was able to set up a php web app debugger in PHPStorm by simply tying it to my localhost at a specific port and everything works fine. However for that to work I need to first run this command on the shell:

php app/console server:run --env=dev

如果我设置断点来浏览网站本身或测试api来自一个基于浏览器的休息客户端,如

This works just fine if I set up breakpoints for browsing the site itself or testing api calls from a browser based rest client like postman

但是我正在尝试为我的移动应用设置断点(移动应用将http调用发送到后端应用程序,这是一个symfony应用程序)。使用Web应用程序配置不适用于此配置。

However I'm trying to actually set breakpoints for my mobile app (the mobile app sends http calls to the backend app which is a symfony app). Using the web app configuration doesn't work for this one.

使用教程我能够将上面的命令行合并到PHPStorm中,所以现在我可以使用phpstorm命令行工具实际运行代码。

Using this tutorial I was able to incorporate the above command line into PHPStorm, so now I can actually run the code using phpstorm command line tools.

我的问题是:如何将调试器实际绑定到PHPStorm中的命令行?现在,当我在PHPStorm中创建时,它默认使用默认的php解释器(即如果我使用内置的Web服务器运行代码..我在PHPStorm的控制台中看到这个:

My question is: How can I actually tie the debugger to the command line within PHPStorm? right now when I create a built-in web server in PHPStorm it defaults to using the default php interpreter (i.e If I run the code using the built in web server.. I see this in PHPStorm's console:

/usr/local/Cellar/php54/5.4.28/bin/php -S localhost:8000 -t /project/root/directory

我想要的是这样的:

php app/console server:run --env=dev -S localhost:8000 -t /project/root/directory

任何想法怎么做?

推荐答案

你根本不应该创建一个运行配置,只需单击listen按钮: / p>

You shouldn't create a run configuration at all, just to click on the listen button:


  1. 配置xdebug以尝试调试每个脚本( xdebug.remote_autostart = 1 xdebug.remote_enable = 1 )。

使用手机句柄图标i n IDE开始侦听调试连接(例如如答案。

if you're interested in doing the same thing on vi + xdebug, see this answer.

这篇关于如何使用Symfony命令行工具在内置Web服务器的PHPStorm中进行调试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-20 08:31