PHP debugging

Anyone else got it working? I have netbeans working, but WebIDE starts, but never hits either a break point, or the first line of code.

Thats the only reason netbeans is still on my mac!

Is it ment to work yet? I did change the port to 9000, the same as xdebug is using etc....

0
29 comments
Avatar
Permanently deleted user

Hello Nik,

Can you give more details on what's happening?
In particular:
1. Is debug session started?
2. Does IDEA display 'Waiting for connection on port 9000' message?
3. Does your browser automatically open a web page that was specified in PHP debug configuration with the query string parameter "XDEBUG_SESSION_START=IDEA" ?
(Currently IDEA supports debugging only on the page specified in debug configuration, see also http://www.jetbrains.net/tracker/issue/WI-135)

If the answers are yes, please provide debugger logs:

1. open <Web IDE installation directory>/bin/log.xml with a text editor
2. scroll to the bottom, add the following lines before <root> tag:

  <category name="com.jetbrains.php.debug">
    <priority value="DEBUG"/>
</category>


3. Restart Web IDE
4. try to start debugging
5. Attach the log file found at <USER home directory>/.WebIde10/system/log/idea.log

Thanks for your feedback,
Kirill

0
Avatar
Permanently deleted user

Hi Kirill

The debug session is started. It doesn't say "waiting", it says connected (in watches and variables), but goes back to "disconnected" when thepage has finished loading.

I have a breakpoint on the first line of code.

I put the log4j change in, but I dont get a log file the xml file says $SYSTEM_DIR$/log/idea.log - but I have no .Webide10

Here's where the problem may be:

My project runs in a VM. My code is local on my machine, and seen from the VM using a shared folder in vmware fusion. So PHP on the server thinks my file is

/mnt/hgfs/workspace/internationalhomepage/webapp/htdocs/internationalhomepage/mvc.php

but webide (ie, my mac) sees it as:

/Users/nic/code/workspace/internationalhomepage/webapp/htdocs/internationalhomepage/mvc.php

Other IDE's have a mapping between the two - if you see /mnt/hgfs/workspace/internationalhomepage, make it look at /Users/nic/code/workspace/internationalhomepage

Thoughts?

0
Avatar
Permanently deleted user

Hello Nic,

Firstly, let me apologize for the wrong information on the log file location. Had no Mac nearby so made a wrong guess . Please look for the logs in ~/Library/Caches/WebIde10/log/idea.log.

What for the problem with paths you've came accross, please watch the Charisma issue http://www.jetbrains.net/tracker/issue/WI-200 to be notified when it's fixed.

Thanks for your feedback,
Kirill

0
Avatar
Permanently deleted user

what am I suppose to enter for "Server Root" the root url like http://localhost or the C:\wamp\www directory.
I think there should be a hint underneath it just like how Eclipse preferences are.

0
Avatar
Permanently deleted user

Thanks, will do that.

Server root means URL like http://localhost. You can start debugging a PHP file by invoking context menu for it and choosing Debug "filename.php" action. This way browser will open a URL given as <server_root>/<relative_path>, where relative_path is the file path relative to the project folder. So server root you enter is expected to correspond to the root folder or your web project.

0
Avatar
Permanently deleted user

How will you handle virtual host
I have one virtual host http://dev.flow3tutorial.local that points to http://wamp/www/flow3tutorial/web
and localhost pointing to http://wamp/www

So i think the debug preferences should be project based not universal, so i can use different server host for files and different ones for different projects just like in eclipse pdt.

0
Avatar
Permanently deleted user
How will you handle virtual host


If you have (had) index.php at the root folder of your Web IDE project, what url does it correspond to? If it is http://dev.flow3tutorial.local/index.php (= http://wamp/www/flow3tutorial/web/index.php), then your server root should be http://dev.flow3tutorial.local or http://wamp/www/flow3tutorial/web (no matter which one since both paths point to the same local file). In case it is http://wamp/wwwhttp://wamp/www/index.php, your server root is http://wamp/www

So i think the debug preferences should be project based not universal, so i can use different server host for files and different ones for different projects just like in eclipse pdt.


Actually these preferences are set per project. Note, they are located under Project Settings group in the Settings dialog as opposed to IDE Settings.

0
Avatar
Permanently deleted user

1. Debug session is started
2. I'm seeing "Waiting for connection on port 9000"
3. Browser URL is http://localhost:8080/test.php?XDEBUG_SESSION_START=WebIDE1

Source is the following:
<?php
  echo phpinfo();
?>

Line with echo does have breakpoint. I also played with "break at the first line" setting.
XDebug command line client (debugclient-0.9.0.exe) works ok
I'm attaching both webide and xdebug logs



Attachment(s):
xdebug.log.zip
idea.log.zip
0
Avatar
Permanently deleted user

Hello Andrew,

Thanks for your feedback,

I couldn't reproduce the problem on XAMPP 1.7.2 with bundled Xdebug 2.0.5. Can you please provide more details, such as your XAMPP version and content of php.ini file?

Also please launch the debugclient, wait for Xdebug connection and issue the command:

   step_into -i 1

It should result in status="break", not status="stopping" response.
If the response is as expected, please detach (detach -i 2) or restart the client and set a breakpoint before stepping in:

   breakpoint_set -i 3 -t line -f file:///C:/xampp/htdocs/test.php -n 2 -s enabled

and then:

   step_into -i 4


Finally, please attach the content of the debugger console window.


Thanks again,
Kirill

0
Avatar
Permanently deleted user

I've tried your trick with step_into -i 1 and got status "stopped". I've reviewed php.ini I found out that php_xdebug.dll was included twice - as an extension and zend_extension_ts. After commenting extension the whole thing start working.
So here is the correct piece for php/php.ini (XAMPP 1.7.1):

;extension=php_xdebug.dll ;<-- should remain commented


[Zend]
;zend_extension_ts = "C:\xampp\php\zendOptimizer\lib\ZendExtensionManager.dll" ;<-- the whole Zend section need to be commented
;zend_extension_manager.optimizer_ts = "C:\xampp\php\zendOptimizer\lib\Optimizer"
;zend_optimizer.enable_loader = 0
;zend_optimizer.optimization_level=15
;zend_optimizer.license_path =
; Local Variables:
; tab-width: 4
; End:


[XDebug]
; Only Zend OR (!) XDebug
zend_extension_ts="C:\xampp\php\ext\php_xdebug.dll"
xdebug.remote_enable=true
;xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
;xdebug.remote_handler=dbgp
xdebug.profiler_enable=1
xdebug.profiler_output_dir="C:\xampp\tmp"


Thank you for your swift response on Sunday!

0
Avatar
Permanently deleted user

My environment is nearly the same (MAMP and Xdebug), I got everything working fine : meaning, the execution will stop on hitting a break point and I inspect variables, add watches, step into and everything BUT if I hit "next step" the code is indeed processed (the new variable vlaue is shown in the watch) but the "red line" (marking which line is beeing debugged) does not move at all. If I hit "next step" again, the line won't move either.

In the left-most pane I can see <Invalid frame> ClassName->method_name.

Could anyone give me advices ?

Thanks alot.

0
Avatar
Permanently deleted user

Hello Axel,

No ready advice

Please provide Web IDE log (details on taking it are above in this thread).

Regards,
  Kirill

0
Avatar
Permanently deleted user

Hello Kirill,

I'm currently at work using an Ubuntu system and it works perfectly, I'll investigate using the logs later on at home.

Edit : I'm really sorry but I can't get any logging info out of my Mac. I'm using the Idea 9.0 beta and I get no logs at all in /Users/Axel/Library/Caches/IntelliJIdea90. there is no directory named "logs" or "system" as mentioned in another thread. I must be missing something...  

Ce message a été modifié

0
Avatar
Permanently deleted user

Hello Axel,

And how about /Users/Axel/Library/Caches/WebIde10 ?

Kirill

0
Avatar
Permanently deleted user

Also one might experience problems with symbolic links: http://youtrack.jetbrains.net/issue/WI-600

0
Avatar
Permanently deleted user

Hello Kirill,

I seem to be having the exact same problem as Axel: using WebIDE 722 and MAMP 1.8.2 w/XDebug 2.0.5 under OS X 10.6, my breakpoints do get hit, but WebIDE seems to be unable to match the returned stack frames to my source files (displaying "<invalid frame>" in the frames window as a result).

I managed to get some logging output for category "com.jetbrains.php.debug". Key facts:

  • I have no path mappings in my Run configuration
  • WebIDE and MAMP both run on my local host, the project directory is directly underneath the MAMP htdocs folder (/Users/mp/MAMP_htdocs)
  • breakpoints are set by WebIDE, e.g. line breakpoint in class A_B_C::methodD() (Line 125):
    • DEBUG - ketconnection.SocketConnection - 2445b199 sending: breakpoint_set -i 11 -t line -f file:///Users/mp/MAMP_htdocs/myproject/classes/A/B/C.php -n 125 -s enabled
  • breakpoints are hit
  • response for the stack_get command looks correct to me:
    • <stack where="A_B_C-&gt;methodD" level="0" type="file" filename="file:///Users/mp/MAMP_htdocs/myproject/classes/A/B/C.php" lineno="125" />
    • <stack ... />
  • WebIDE does not match the stack frame to the correct code location, resulting in "<invalid frame>" being displayed
  • Contexts are displayed, variables present are consistent with the breakpoint location
  • The idea.log does not contain any severe entries (other than DEBUG and INFO).


Is this a problem with my settings, or should I file a bug report? I can provide a log from an actual project via PM.

Regards,

Michael

0
Avatar
Permanently deleted user

Hello Michael,

The bug http://youtrack.jetbrains.net/issue/WI-480 is fixed. Unfortunately the fix didn't get into Web IDE EAP build 722 so please check with the next EAP build.

Regards,
Kirill

0
Avatar
Permanently deleted user

Hello Kirill,

now that's good news!

Thanks for the quick reply, and simply for another great product ...

Regards,

Michael

0
Avatar
Permanently deleted user

I'm glad PHP debugging has been fixed for next EAP.  Also i've commented on this symbolic-link issue.  Would be great if that could be addressed, it's always been a huge issue for me and if JetBrains can solve it you'll become my number one fan.  I left IntelliJ when i left Java several years ago and it was a very sad day when I lost my IDE of choice. I work exclusively with PHP now and having a JetBrains powered PHP IDE would make me a very happy man.

0
Avatar
Permanently deleted user

I forgot to ask: any ETA for the next EAP?

0

We plan to publish it in next 1-3 (working) days.

0
Avatar
Permanently deleted user

Hi All,

Could you please help me with configuring the WebIDE with xdebug on Denwer ?

I start the debug session, the browser opens window with:
http://samlpe/index.php?XDEBUG_SESSION_START=WebIDE1

But in IDE it is still "Waiting for connection on port 9000 with ide key WebIDE1".

I have added the following strings in the log.xml:

<category name="com.jetbrains.php.debug">
    <priority value="DEBUG"/>
</category>



I use php.ini config:

extension=php_xdebug-2.0.3-5.2.5.dll
zend_extension_ts = E:\projects\usr\local\php5\extphp_xdebug-2.0.3-5.2.5.dll


xdebug.remote_enable = On
xdebug.remote_autostart = On
xdebug.auto_trace = On
xdebug.remote_host = 127.0.0.1
xdebug.remote_enable = 1
xdebug.remote_port=9000
xdebug.remote_handler = dbgp
xdebug.remote_mode=req
xdebug.idekey=WebIDE1


xdebug.profiler_enable  = 1
xdebug.profiler_output_dir = E:\temp\xd



Attachment contains screenshot of the debug settings window.

Thnaks in advance.

Attachment(s):
pic.jpg
0
Avatar
Permanently deleted user

Hi Pavel,

First please make sure XDebug is configured correctly and does not conflict with other extensions. Just execute the file with phpinfo() call on server and check the output contains XDebug part, i.e.

This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.3.0, Copyright (c) 1998-2009 Zend Technologies
    with Xdebug v2.0.3, Copyright (c) 2002-2008, by Derick Rethans


Also please specify xdebug.remote_autostart=0 (or just remove this setting) and remove xdebug.idekey setting since WebIDE is controlling the latter parameter itself.

Regards,
Kirill

PS You don't need to modify your log.xml unless you're going to send us some logs . Web IDE debugging logs may take a space on disk, so consider turning it off for everyday work.

0
Avatar
Permanently deleted user
0

I'm having similar problems. I've been debugging successfully for weeks(Console, Unit AND On server) and suddenly this morning brealkpoints have stopped working. Any ideas?

0
Avatar
Permanently deleted user

Hello Jim,

Does 'Validate Xdebug setup' report anything? (enable checkbox in run configuration dialog, when start debugging).

Does your phpinfo() output contain Xdebug?

Regards,
Kirill

0

'Validate Xdebug setup' seems to report nothing. What would it look like if it did??

My phpinfo is attached



Attachment(s):
phpinfo.php.html.zip
0

Actually Validate xdebug has been reporting the attached for months but it was never a problem



Attachment(s):
Screen shot 2010-09-03 at 10.27.51 AM.png
0
Avatar
Permanently deleted user

Hello Jim,

I see, validation just fails.To validate, PhpStorm uploads a small PHP script on your server and tries to retrieve it by HTTP. The reason it fails may be that Apache process has no access to the file (e.g. lack of file permissions in this directory).

Anyway, your  phpinfo() output does not show Xdebug installed. Please check /opt/local/etc/php5/php.ini file (and probably opt/local/var/db/php5/xdebug.ini that it includes) to contain proper configuration settings for Xdebug.

Regards,
Kirill

0

Please sign in to leave a comment.