网站优化

网站优化

Products

当前位置:首页 > 网站优化 >

如何使用PHPStorm调试WordPress主题

GG网络技术分享 2025-03-18 16:12 0


问题描述:

I\'ve installed PHPStorm (8) and trying to debug WordPress theme using xDebug. I tried chrome browser extension and some other settings in the PHP Storm settings.

I\'ve searched a lot but still unable to attach the page to the debugger. What I want is to run the code line by line and check variables etc.

Can someone tell me what exactly is required so the debugging works?

I\'ve following structure:

WAMP is at:  c:\\wamp

Project is: d:\\projects\\test

alias is: http://localhost/test/

When I opened the project in PHP Storm. It identified it as WordPress project. But it never attaches the browser to debugger.

EditHere is the related xDebug code in php.ini

zend_extension = \"c:/wamp/bin/php/php5.3.13/zend_ext/php_xdebug-2.2.0-5.3-vc9.dll\"

[xdebug]

xdebug.remote_enable = 1

xdebug.profiler_enable = 1

xdebug.profiler_enable_trigger = 1

xdebug.profiler_output_name = cachegrind.out.%t.%p

xdebug.profiler_output_dir = \"c:/wamp/tmp\"

xdebug.remote_port = 9000

I also tried true instead of 1. Also tried without providing any port.

网友观点:

There seem to be a lot of ways to set up debugging. There are browser plugins, and bookmark commands, and all sorts of elaborate setups.

For the most part, I always want debugging enabled while I\'m developing. If that\'s true for you, you might consider adding this to your php.ini file:

xdebug.remote_autostart = 1

In addition, a key part to my setup is that I have to click the button in the toolbar for \\\"Start Listening for PHP Debug Connections\\\", and keep this enabled while I work. This is also in the menus under \\\"Run\\\".

###

Have you tried zero-configuration guide for PhpStorm debugger?

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

I\'m using this solution and it works fine.

Don\'t forget to add breakpoints and I recommend to create the bookmarklets to activate/deactivate debugger cookies in browser (https://www.jetbrains.com/phpstorm/marklets/).

标签:

提交需求或反馈

Demand feedback