XAMPP PhpStorm XDebug not stopping on breakpoints

2019-08-10 20:20发布

问题:

I have a Windows 7 machine with XAMPP(Apache 2.4.4 - Win32 PHP 5.4.16) and PHPStorm 6.0.3 For the life of me I cannot get XDebug working on this machine!! I look at my PHPInfo page:

This tells me that I need to download XDebug "PHP 5.4 VC9 TS (64 bit)" I download and copy to produce: C:\xampp\php\ext\php_xdebug-2.2.3-5.4-vc9-x86_64.dll My PHP.ini has:

[XDebug]
zend_extension_ts = "C:\xampp\php\ext\php_xdebug-2.2.3-5.4-vc9-x86_64.dll"
xdebug.profiler_append = 0
xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = 0
xdebug.profiler_output_dir = "C:\xampp\tmp"
xdebug.profiler_output_name = "cachegrind.out.%t-%s"
xdebug.remote_enable = 0
xdebug.remote_handler = "dbgp"
xdebug.remote_host = "127.0.0.1"
xdebug.remote_port = 9000
xdebug.trace_output_dir = "C:\xampp\tmp"

I re-start XAMPP but the PHPInfo page still does not have XDebug in it?

回答1:

Answering my own question is not what I wanted to do but here we go. I figured out that I was using XAMPP in 32bit mode - I added echo PHP_INT_SIZE; to the top of my phpinfo.php page and it returned 4 (32 bit) I downloaded "PHP 5.4 VC9 TS (32 bit)" but made my PHP.ini read:

zend_extension = "C:\xampp\php\ext\php_xdebug-2.2.3-5.4-vc9.dll" - removing the _ts from zend_extension_ts



回答2:

In Additional:
Check security options of .dll xdebug file. If you see on file's icon small lock icon - nobody except you can't use this file. In that case add Users group in security tab in file's properties.



回答3:

By the way, you should try to go to the php.ini and delete a line like this

extension=php_xdebug-...

It wasn't a good reason to put the Xdebug file here

C:\xampp\php\ext\

The better path is

C:\xampp\php\zend_extension\

More details are here "Xdebug - command is not available"



回答4:

(This is for Mac, but written to work with Windows mostly)

The confusion may come from which PHP your server is using. For example, there's the Mac OS X one, maybe one from "brew install...", and XAMPP's one.

  1. Identify which PHP on your machine that PhpStorm is using. It's this one that needs XDebug. Let's use XAMPP's PHP. To find it,

    <?php phpinfo();?>
    

    Where it says _SERVER["_"] (on my Mac it's _SERVER["_"] => /Applications/XAMPP/xamppfiles/bin/php ).

  2. Does it have XDebug? (Search for 'xdebug' from the above phpinfo(); output.) Mine does.

  3. If you don't, let's install it! Copy/paste entire text of phpinfo() output into this nifty XDebug wizard. Before I had XDebug, mine showed exact instructions:

    • But also add this line xdebug.remote_enable = 1 right below Step 8's so that XDebug will always be listening once told to do so!

  4. Restart XAMPP.

  5. Download XDebug Chrome extension

  6. Go to the page you want to debug and select 'Debug' from the extension icon.

  7. Go to PhpStorm preferences like this and select the correct "PHP Language Level", then click the 3 dots next to "CLI INTERPRETER" and put XAMPP's PHP path in the "PHP executable" field. It should say the Xdebug version on the right.

  8. Go to PhpStorm preferences like this and add your paths; for me they're the same because mine's local, but it still needs to know "this page I'm hitting is this file on your machine". Click "OK".

  9. Click the phone in top right and reload the page in your browser

Reload the page and it should stop at your first breakpoint it hits.