Xdebug不能在PHPStorm IDE中工作


Xdebug not working in PHPStorm IDE

我正在尝试在PHPStorm IDE中设置xdebug,我遵循了一个文档中提到的步骤

我遵循这个文档:"http://www.mysolutions.it/phpstorm-server-xdebug-configuration/"。

但是我得到一个错误"端口9000很忙",如果我运行调试,它正在退出。我将分享我的配置设置

我所做的步骤

在我的Xdebug.ini

zend_extension="/usr/lib/php5/20090626/xdebug.so"
xdebug.default_enable = 1
xdebug.idekey = "vagrant"
xdebug.remote_enable = 1
xdebug.remote_autostart = 0
xdebug.remote_port = 9000
xdebug.remote_handler=dbgp
xdebug.remote_log="/var/log/xdebug/xdebug.log"
xdebug.remote_host="myip"

File->settings->PHPservers
Host : Ip for the virtual machine(Ip added in the host file)
Port:80
Debugger:Xdebugger

我选中了复选框(Use PathMappings)

在项目文件下(服务器上的绝对路径:/var/www/myproj)

File->settings->Deployment
连接:

类型:FTP FTP主机:my virtual machine ip port:80根路径:/var/www

映射:

本地路径:/Users/m1019238/dev/myproject/myproj

服务器上的Web路径:/var/www/myproj

我将分享任何东西,如果我错过了任何设置,我所做的除了这个。

我刚刚将"构建,执行,部署"->"调试器"上的端口更改为类似9001的其他内容,并将其放回9000。这很奇怪,因为PhpStorm本身也在使用这个端口。

对于其他可能无意中发现这个并且不想破坏整个配置的人,您可以在这里找到您的PHPStorm配置文件路径:https://intellij-support.jetbrains.com/hc/en-us/articles/206544519-Directories-used-by-the-IDE-to-store-settings-caches-plugins-and-logs

找到config文件夹后,文本搜索使用的端口应该找到配置PHP自动使用该端口的文件(假设phpstorm是侦听该端口的应用程序)。

对于我来说,在mac上,它在~/Library/Preferences/PhpStorm2017.1/options/other.xml

<application>
    <component name="BuiltInServerOptions" builtInServerPort="9000" builtInServerAvailableExternally="true" />
</application>

内置服务器默认为9000。将其更改为其他内容可以解决问题。请注意,对于我的情况,原来我也可以改变IDE本身的Build,Execution,Deployment> Debugger> Port选项。

我才知道我错在哪里:

php-fpm正在监听9000,所以请确保没有运行php-fpm,如果是,您必须在更改php-fpm端口或xdebug端口之间做出选择。