How to debug PHP Web Application using Aptana
Asked Answered
J

1

6

This feels like a really stupid question, but I cannot find any YouTube videos / articles / guides / etc that explain the debugging process in Aptana.

I've found the ones that explain how to install the XDEBUG or ZEND components, and that's all good. Now, how do I use them? I can see all sorts of menus, server configurations, debug configurations, but I cannot find a guide that explains how to actually set about using them.

Is there some sort of "PHP debugging with Aptana for dummies" that would provide a very direct walkthrough, something along the lines of:

  1. This guide starts by assuming you have installed XDEBUG into your Aptana studio, and confirmed it with phpinfo().
  2. Setup a debug configuration by....
  3. Start your debugger by ....
  4. Step through the code by ....

and so on.

It sounds so obvious, but I cannot even find something like that for a different IDE.

Please someone put me out of my misery.

Jennifer answered 19/7, 2013 at 8:55 Comment(3)
Found this article describing how to debug a script. php.tutorialhorizon.com/how-to-debug-php-in-aptana-studio Not quite complete for debugging a web application, but a good start.Jennifer
Came across a book titled "Aptana Studio - Beginners Guide" by Thomas Deuling. Table of contents explains debugging, but not of PHP.Jennifer
Found another article describing how to enable XDEBUG. devcircle.blogspot.co.nz/2013/02/… It fills in a few more gaps, but still doesn't quite do the job.Jennifer
J
4

Hope this helps someone... heaven alone knows why I've battled so much with it.

I am using Aptana Studio 3, build 3.4.2..... And XAMPP ver 1.8.1 installed on C:\xampp (on a windows machine)

1. Ensure that XDEBUG is PROPERLY installed.

I moved to a new computer, and forgot to check. :(

Open php.ini file under \php directory Make sure the following lines are uncommented (no semicolon)

zend_extension="<Xampp_Home>\php\ext\php_xdebug.dll"
xdebug.remote_host=localhost (change 'localhost' to '127.0.0.1')
xdebug.remote_enable=0 (change '0' to '1')
xdebug.remote_handler="dbgp"
xdebug.remote_port=9000

Save and restart web server.

2. Setup your web server in Aptana under Window > Preferences > Aptana Web Studio > Web Servers.

(I use virtual host containers.)

Name: MyWebServer 
URL: http://MyProject 
DocumentRoot: c:\xamppProjects\MyProject\php

3. Setup the PHP interpreter in Aptana under Window > Preferences > Aptana Web Studio > Editors > PHP > PHP Interpreters.

Add...

Name: XAMPP PHP Debugging 
Executable path: C:\xampp\php\php.exe 
PHP ini file: C:\xampp\php\php.ini 
PHP Debugger: XDebug

Now try it out

In Aptana Studio, select the Debug perspective. Open a browser and fire up your app (http://MyProject) Aptana interrupts with a pop window titled "Incoming JIT debug request" and asks "A remote debug request was received from 'MyProject'. Would you like to break on the first line?"

Select yes, and you're into the debugging.

Once I got to this point, I found the setting of breakpoints and tracing the flow pretty painless.

Jennifer answered 1/6, 2014 at 9:18 Comment(1)
Do you have any idea how to set the default perspective when the JIT debugger launches, and the default perspective to switch to (or force "switch back") when the debugger is stopped by clicking the red Stop button? I can't figure this out for the life of me. Aptana/Eclipse's preferences are very difficult to find and configure... Everything is thrown to the winds and confusing.Erythromycin

© 2022 - 2024 — McMap. All rights reserved.