XDebug with Aptana Studio 3 - php

I would like to know how i can get XDebug work with Aptana Studio 3 (I already have Aptana Studio 3 on this machine with XAMPP).
Do you know a recent article telling me how to do this and explains XDebug? I have no experience nor any knowledge about XDebug, i looked for articles but all seem outdated to me.

I realize that this is a old thread but I also had a difficult time finding out how to debug php with Aptana Studio and FireFox so here is a quick how-to to get it working...
The easiest way I found is to install wamp server V2.2, this is a very useful program as it installs Apache Server, PHP and MySQL and other tools, everything can be easily configured via the taskbar.
1.) Install Aptana Studio V3.3.X or higher Download here
2.) Install WampServer V2.2 or higher Download here (XAMMP users read bottom).
WampServer:
1.) Make sure XDebug is accepting remote debug, click on the WampServer icon in the taskbar and go to PHP->PHP Setting and make sure that "(XDebug): Remote debug" is checked if not select it click on the WampServer icon and "Restart all services".
2.) Verify that XDebug is running:
a.) If you had WampServer insert index.php enter "localhost" in the URL and under "Tools" click "phpinfo()" and check to make sure XDebug is running, you should see the following in FireFox:
b.) If you didn't overwrite the index.php create a file (/www_dir/phpinfo.php) with the following:
<?php
phpinfo();
?>
b.1) In FireFox enter "localhost/phpinfo.php" and look for XDebug as shown in the previous image.
Aptana Studio:
1.) Click Window->Preferences
2.) In the Preferences dialog go to Aptana Studio->Editors->PHP->PHP Interpreters
3.) Click "Add..."
4.) Enter the information like
5.) Click "OK"
6.) Click on the debug icon and select "Debug Configurations"
7.) Double click on "PHP Web Page"
8.) Click the plus next to "PHP Server"
a.) Enter a name
b.) Base URL will be "localhost"
c.) Document Root will be the path to your index.php
Finally in Aptana Studio click the Debug Icon Arrow and select the configuration you named above. If Firefox prompts you install the Aptana Studio plugin...
Hope this helps out...
-------------
XAMPP USERS
-------------
Follow the steps provided but your directory link in the
In the Preferences dialog go to Aptana Studio->Editors->PHP->PHP Interpreters
should link to C:\xampp\php\php.exe and C:\xampp\php\php.ini respectively
***** UPDATE *****
If you are using Firefox V20+ there are some compatibility problems with Firebug V1.8+ that basicly breaks Firefox's context menus, I could not find a fix for it so I ended up having to go another route and figured I should make a post, Aptana Studio is based on Eclipse so the best way IMHO to get PHP Debugging is to install Eclipse with PDT and remove Aptana Studio... The above instructions will work to get everything working with XDebug
Here is a nice link on how to get everything up and running eclipse-pdt

At the moment, there is no PHP debugger support in Aptana Studio 3. However, there will be soon. See: http://jira.appcelerator.org/browse/APSTUD-769 and add yourself as a watcher to get informed when it's done.
For now, you can install PDT from eclipse.org if you really need to debug.
They also provide up-to-date docs on how to use it. There is a small learning curve, but it will work pretty much the same in Aptana (once it's released), so you have nothing to lose :)

Here is a mini how-to configure and start using XDebug with Aptana Studio 3.3, assuming you have installed xdebug on your system. (In Ubuntu/Linux it's just a sudo apt-get install php5-xdebug).
Configure the debugger
In preferences->Aptana Studio->PHP->PHP Interpreter click on Add..., and specify a name, the php executable(/usr/bin/php in most Linux distributions), the php.ini(/etc/php5/conf.d/20-xdebug.ini on my system), and leave XDebug in the select field of PHP debugger.
Using the debugger
Make a php file and put some code in it:
<?php
$defined_var = 'some value';
echo $defined_var;
echo $undefined_var;
exit();
?>
Save it and press Run->Debug As->PHP Script and you will be prompted to switch Workspace.
Specify a Line Breakpoint by double clicking next to a line number, for example at the line of exit() function.
Press Resume(F8) and you can see that the Debug Current Instruction Pointer moved there.
At the variables tab, you should now see which variables have some value or they are uninitialized. The output can be found at the console tab.
Pressing resume again will terminate the debug.
Of course, this is only the tip of the iceberg regarding debug, but it's a start.
There are many other options to explore and ways to debug your scripts.

I have use Aptana Studio 3.2.2 to develop my Drupal site and use XDebug to debug the project. The Aptana Studio supports xdebug. You need to follow some steps to enable xdebug in Aptana Studio.
Configure xdebug in your php engine properly.
Edit the preference by going Preference -> Aptana Studio -> Editor -> PHP Interpreter.
Add a PHP interpreter and save it.
Now create a new Web Server if no web server is currently working.
Now Apply the changes.
Next, Edit the Debug Configuration using Run -> Debug Configurations -> PHP Web Page.
Add a new web page by selecting a initial script file for the php project.
In the last step, start debugging.
You can find a details step by step procedure in the following link:
http://devcircle.blogspot.com/2013/02/enable-xdebug-in-aptana-studio-3x.html
Hopefully it helps to solve the problem.

For me it worked only after
1. Performing stuffs from here (basically - setting-up the XDebug for remote debugging)
https://jira.appcelerator.org/secure/attachment/26404/ScriptPHPDebugging.pdf
2. installation of "XDebug helper" for chrome, and something similar for FF.
After that I have my remote sessions working just-like-they-did-in-Eclipse.

Related

Debug PHP on Mac

I use Visual Studio Code IDE on a Mac, and the MAMP stack to develop a website with PHP.
I want to debug the PHP.
I saw this post about debugging PHP with the visual studio code extension: php-debug.
I installed it in my visual studio code but I see that I need to download Xdebug for it to work.
I see on the Xdebug website that it has no download files for Mac OS X.
However, some PHPdebuggers for mac are Xdebug clients for mac. As shown here.
Does this mean that I can somehow download Xdebug for mac OS X so that my Visual Studio Code php-debug extension works?
If so how?
If not, what is my next best option? - Can I use Visual Studio Code IDE to develop with and a completely separate tool to debug PHP with? In that workflow, would I be just running the site in the browser and the third party tool stops on the breakpoints?
I downloaded codebug for mac, and opened my project in it, and put break points on the code, then ran my website locally. The code did not stop on the break points. What was I missing?
Thanks.
The route I took is upgrading to MAMP PRO. It may be possible to do it with MAMP (non-pro) if you do a bit more setup work for Xdebug.
Upgraded to MAMP PRO and adapted this tutorial for Visual Studio Code. In Visual Studio Code install php-debug, and in MAMP PRO under the PHP tab check the checkbox to debug with Xdebug. Then in Visual Studio Code in the debug view, click the gear icon and choose PHP. This creates a launch.json file. Save the file without changing any defaults, unless you know your xdebug is on a different port. Then just press the play button in the debugger in Visual Studio Code, enter in some breakpoints into the PHP code, and browse to the website. The debugger should stop the execution on the breakpoints.

Aptana php server debug mode opens empty page in firefox

I am using Aptana 3 studio to work on my php (drupal) projects. All of the sudden, the debug function stopped working. It used to work flawlessly. Now when I select a debug configurtion and debug it, an empty page opens in firefox.
Is this connected with how Aptana communicates with the browser? With the server?...
EDIT:
So I decided to try a new thing altogether and installed a full new system based on LXLE 14.04 (based on the same ubuntu 14.04, which I used in a full unity version before).
Now, after some quirks, I have a running debug in Aptana on that system. I am pretty sure, though, that this is the configuration that worked for me in the first place.
I also remarked some weird window behavior on the system - sometimes the Aptana window would get so small it is hardly noticable (1px*1px?) and gets to the top left corner.
I found that setting xdebug.remote_autostart=1 in php.ini and restarting Apache allows me to debug somewhat. Although Firefox still opens a blank page, opening the page myself in the browser now allows me to get a break in Aptana.

xdebug breakpoints work but step over does not

I have installed Xampp on Windows (Well actually both xampp and wamp but both have the same problem), and enabled xdebug. I have installed the latest eclipse for php with pdt included. The breakpoints are working correctly however if I press f6 or f5 the current line does not get updated, the variables change as if I had stepped to the following line but the highlighted line remains the same. Any ideas?
I attach some screenshots to make it easier to understand:
Breakpoint works:
I press f6, lineno and $a changes in the 'Debug' and 'Variables' window:
I press f6 again:
I tried updating to the latest xdebug but the same thing happens.
This is problem in Eclipse SR1. You should switch back to R (SR0) release, next you can install PDT 3.3.1 from marketplace.
See also bug report on bugzilla
Edit:
Problem is fixed in nightly builds: http://download.eclipse.org/tools/pdt/updates/3.4-nightly/
Edit 2:
We released new stable (3.3.2) version with fix for this problem. You can find it on marketplace or in this update site: http://download.eclipse.org/tools/pdt/updates/3.3.2/
Goto Eclipse->Help->Install New Software
Work with: http://download.eclipse.org/tools/pdt/updates/3.3.2/ (this worked for me)
Alternative: You might want to use the latest stable update site: http://download.eclipse.org/tools/pdt/updates/latest/
[If not already existing]: click (Add) & give a name like "PDT" in order to add the upgrade site.
Type "PDT" and tick checkbox for "PHP Development Tools (PDT)"
Accept the license stuff and upgrade PDT.
Restart Eclipse

What is the right way to install codesniffer to Aptana Studio standalone version?

I followed this guide for eclipse integration on drupal:
https://drupal.org/node/1420004
I tried to install PTI plugin to Aptana
(Aptana Studio 3, build: 3.4.1.201306062137, with Eclipse Platform Version: 3.7.2.v20120207-1839-9gF7UHPDFxGjd-PqDr2jX_4yKaumkoHTz04_q-q)
, but got a lot requirement missing errors.
Then I enable Eclipse Indigo Update Site (http://download.eclipse.org/releases/indigo) in my Aptana, and installed it successfully this time.
Then I config it like this:
But it just don't work!
I have installed php codesniffer and pear library, it works perfectly in command-line, and git pre-commit hook, but I can't get it work in Aptana.
Even I right click on a file, the PHP Codesniffer is grey and unclickable.
I wonder what is the right way to install codesniffer to Aptana Studio ?
You will need to set up the "PHP Executer". Use the link on the side of that select-box and configure one, poiting to the php binary you have. It probably is /usr/bin/php5. If the .ini file is required, it'll probably reside in /etc/php5/cli/ or /etc/php5/apache2/.
If those are not correct, you can execute and retrieve the location of that information.
I needed to set this up in order to have my codesniffer working. I couldn't find how to make it work without clicking in the button in the editor's toolbar, but It worked.

JIT debugging PHP in Aptana Studio

Linux Mint 15, Aptana Studio 3.4.1, Chromium 28.0.1500.71
Sorry, this is a little lengthy to explain. Please let me know if something's not clear.
The title is my goal. I have a local server set up with Apache2. I don't know if it matters, but I have dnsmasq set up to redirect, for example, site.dev/index.html to /home/wastvedt/Projects/site/www/index.html (described here).
I've followed the tutorials I can find. XDebug is running, I have the helper installed in Chromium, and the debugger, interpreter, and web server set up in Aptana.
I'm working on a WordPress site and want to break on one of the functions in my theme's functions.php file. I created a breakpoint in the function in Aptana, turned on the XDebug helper in Chromium, and updated a post, which calls the function in question. Aptana recognizes what I'm doing and prompts me with the option of breaking on the first line. Regardless of what I select, I see "XDebug JIT Session [Remote Launch]" in the Debug view. The prompt appears three times, but nothing else happens in Aptana.
I think the problem might have something to do with linking files in the editor to files in Apache. When I try this JIT debugging thing with "localhost" (located at /home/wastvedt/apache2/www/index.php), Aptana brings up /home/wastvedt/Projects/site/www/index.php. This isn't right, but maybe the real problem is somewhere else. To be honest I'm a little lost now.
Any thoughts? I'd provide some sort of dump or output, but I'm not sure which or what.
Thanks for reading,
Trygve
In order to properly setup XDebug with Aptana I setup the below options by going to the Window menu -> Preferences -> Aptana Studio -> Editors -> PHP -> Debug:
Allow multiple debug sessions: Always
Break on first line when an unknown remote sessions (JIT): Never
Then click on XDebug in Installed Debuggers -> Configure:
Use Multisession: OFF
Accept remote session (JIT): any
That pretty much made it work for me.

Categories