[Solved] Debugging PHP Code - PhpStorm, Xdebug, WAMP, CodeIgniter

Hi guys, I'm finding Debugger Impossible to Setup in PHPStorm, and I'm only trying to use it locally because the features I would like to use are; "Watch" and "Break Points".

Followed instructions (for Zend Debugger) in help, and all I get are more problems. Seriously seems like I'm going backwards with your help F1 gizmo.
Tried with new Zend Server to help get it working, can't work out how to get around issues.

Is there a video to show me someone setting up and testing this working from scratch?

  1. Can I just use XDebug instead of Zend Debugger (and be able to use Watch and Breakpoint?)
    • Note: XDebug is setup and working on my local server
  2. Is there a video for me to follow?
  3. Does it work with MVC and URL Rewrites? (I do not want any extra url params entered)
    • I'm using CodeIgniter PHP framework (index.php is not displayed in url, special characters are not allowed for XSS prevention)
  4. PHP Info shows Zend Debugger running?
  5. Does anybody have a CodeIgniter app working with this ZendDebugger, Watch, Breakpoints in PHP Storm? :-/


?:|

Visual Studio .net sooo simple.
My friend says that Eclipse has debugging functionality and works easy... why is this so hard here.

Cheers,
Chris

8 comments
Comment actions Permalink

Hi Chris,

Have you looked at these articles? I had no issues configuring it.


Make sure that zend debugger is configured properly (port number in PhpStorm matches zend debugger settings etc) + make sure that no other IDE is listening on the same port.

As for the questions:

  1. I do not know any.
  2. Yes. There is no difference -- at the end of the day ALL debuggers are working with actual files and not URLs.
  3. Is this a question or statement?


P.S.
I suggest you start with brand new very simple project first.

Once you make debugger work there -- only then move to the real (more complex) project -- this will ensure that debugging works and should allow you to understand how it works in PhpStorm (and if there are issue with debugging complex project, it would be just a matter of some additional settings rather than possible "this product is crap/too complicated because it does not work for me" statements -- works for other people).

0
Comment actions Permalink

Hi,

I read the help section about debugging and http://confluence.jetbrains.net/display/WI/Zero-Configuration+debugging+with+PhpStorm+2.0 but I'm still having troubles. I think the phpstorm IDE for remote debugging is very difficult to set up.

I have this page:
11_page.png

then click on Debug this page.


Here are some snapshots of some of my settings and mapped paths:
http://tutorialref.com/phpstorm/

0
Comment actions Permalink

Hi,

I read the help section about debugging and http://confluence.jetbrains.net/display/WI/Zero-Configuration+debugging+with+PhpStorm+2.0 but I'm still having troubles. I think the phpstorm IDE for remote debugging is very difficult to set up.

1) I have this page:
http://tutorialref.com/phpstorm/11_page.png

then click on Debug this page bookmarklet.

The page refreshes but nothing happens in the IDE.

See this page:
http://tutorialref.com/phpstorm/ide.png

I have a breakpoint at line 5. From here an ajax is made and the file "11_modCheckGrantor.php" should be called and I have another breakpoint in this file. But the IDE does nothing.

2) Secondly, I then tried just using SHIFT+F9 to start the debug on my already set up 11_page.php.

The Chrome browser opens to this page:
http://dyi.ultratrust.com/form/11_page.php?XDEBUG_SESSION_START=18089

But nothing stops at the breakpoints. I have a breakpoint on line 5 of 11_page.php

Here is a snapshot of my 11_page.php Web Application settings:
http://tutorialref.com/phpstorm/11_page_php_web_application_settings.png

I notice the that Red button (for CTRL+F2) is on so I can stop the process. It does seem like the IDE is waiting for something but I don't know how to stop at the breakpoints. Is my mapping wrong?

Here are some snapshots of some of my settings and mapped paths:
http://tutorialref.com/phpstorm/

What am I doing wrong here?

Thanks,
Victor

---

I think the IDE is a very good IDE but having a thorough step-by-step tutorial with snapshots like this page: http://confluence.jetbrains.net/display/WI/Zero-Configuration+debugging+with+PhpStorm+2.0
would be very helpful to people like me and others. It seems like this page though is missing a lot of other steps before it.

---

0
Comment actions Permalink

P.S.
I suggest you start with brand new very simple project first.

Adding this update here to help others... and attached a couple of files.

Status: So far so good

I did what you suggested.

  1. Instead of Zend, I went back to Apache (WAMP) and Xdebug... as that was already installed and working. (I didn't realize that they both did debugging during running the scripts)
  2. Created a PHP file, simply just HTML and PHP.
  3. It worked. The script stopped at the Breakpoint, and I was able to add a Watch to variable ($i) and it showed the correct value for the breakpoint I was stopped at. Perfect so far.


Next I will try this with a Codeigniter page, see what happens. B-)



Attachment(s):
example-debugging-with-phpstorm-xdebug-breakpoint-watch-variable.png
php-ini-xdebug-settings.png
0
Comment actions Permalink

Bazzik wrote:

Hi Chris,

Have you looked at these articles? I had no issues configuring it.


Make sure that zend debugger is configured properly (port number in PhpStorm matches zend debugger settings etc) + make sure that no other IDE is listening on the same port.

As for the questions:

  1. I do not know any.
  2. Yes. There is no difference -- at the end of the day ALL debuggers are working with actual files and not URLs.
  3. Is this a question or statement?


P.S.
I suggest you start with brand new very simple project first.

Once you make debugger work there -- only then move to the real (more complex) project -- this will ensure that debugging works and should allow you to understand how it works in PhpStorm (and if there are issue with debugging complex project, it would be just a matter of some additional settings rather than possible "this product is crap/too complicated because it does not work for me" statements -- works for other people).


Status: Solved! The PHP debugger is working :)

Notes:

  1. Running an MVC app, CodeIgniter, the URL does not include index.php, the URL is very limited in what characters are allowed, the PHP scripts cannot be called directly
  2. Using Xdebug (not Zend)
  3. Using Apache, (WAMP)
  4. I used these 2 links provided by Bazzik
    1. http://confluence.jetbrains.net/display/WI/Zero-Configuration+debugging+with+PhpStorm+2.0 (ignore xdebug references -- just "replace" them with zend debugger)
    2. Bookmarklets: http://www.jetbrains.com/phpstorm/marklets/


I am attaching a lot of files in here to allow others to setup same and try to get to same results.

Thank You Bazzik!



Attachment(s):
phpstorm-debug-php-debug-xdebug-proxy.png
phpstorm-debug-php-servers.png
phpstorm-debug-php-server-settings.png
phpstorm-debug-php-settings.png
bookmarklets-used-xdebug.png
0
Comment actions Permalink

Hi Chris,

Glad you worked that out.

Few comments (based on screenshots):

  1. You do not need to change anything for Xdebug Proxy if you do not use it (which is most likely the case -- it only required if more than one developer does debugging of the same REMOTE code + it requires additional software/proxy script to be installed and running on the remote (usually) machine).
  2. phpstorm-debug-buttons-I-used-with-codeigniter.png --> "Don't need this". Yes and No. You can use those as long as you create and select entry of correct Run/Debug Configuration type (Run | Edit Configurations..."). On screenshot you have "PHP Script" type (used to execute/debug local scripts in command line environment). For web based debug, you need "PHP Application" or "PHP Remote Debug", where you can enter actual URL (the difference is in how debugger session is initiated: 1st can trigger everything from IDE while 2nd only launches internal listener (debug panel) but session still has to be initiated externally (e.g. via browser extension or bookmarklet) ).
0
Comment actions Permalink

Bazzik wrote:

Hi Chris,

Glad you worked that out.

Few comments (based on screenshots):

  1. You do not need to change anything for Xdebug Proxy if you do not use it (which is most likely the case -- it only required if more than one developer does debugging of the same REMOTE code + it requires additional software/proxy script to be installed and running on the remote (usually) machine).
  2. phpstorm-debug-buttons-I-used-with-codeigniter.png --> "Don't need this". Yes and No. You can use those as long as you create and select entry of correct Run/Debug Configuration type (Run | Edit Configurations..."). On screenshot you have "PHP Script" type (used to execute/debug local scripts in command line environment). For web based debug, you need "PHP Application" or "PHP Remote Debug", where you can enter actual URL (the difference is in how debugger session is initiated: 1st can trigger everything from IDE while 2nd only launches internal listener (debug panel) but session still has to be initiated externally (e.g. via browser extension or bookmarklet) ).

Hey Bazzik

1. Yes, figured that. Did not touch proxy, just put there for completion. For others to see that it's default.
2. That's a good tip, thanks. I should have looked more thoroughly on that list. However, note, I'm using the [Debug Listener]... I did not need to configure anything. To me that's easier. I just go to any page I want. I have heaps of pages, 100 pages or so, I don't want to configure anything special - just debug output + watch.

Note: :8} I was only using xdebug out direct to screen and firedebug. :O These both make the code dirty, and it's about time I do it properly with on the fly debugging with break points :8}

0

Please sign in to leave a comment.