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.
Related
I´m starting working with PHP on Eclipse and I´m having a bad time with XDebugger. This is my first time setting up this enrironment...
I´m running Eclipse 3.8.1 with PHP Development Tools SDK (I have also C++ installed on this Eclipse).
I´ve followed the instruction from the official xdebug site to install XDebug. It seens to be installed fine, as we can see from a phpinfo() call:
Well, once installed, I go to Eclipse, insert my breakpoints on the code, configure the debug configuration and when I call Debug As->PHP Web Application all I get is an empty window on Firefox with the following link:
http://localhost/myproject/index.php?XDEBUG_SESSION_START=ECLIPSE_DBGP&KEY=14380396300041
Absolutely nothing happens neither to Eclipse or on Firefox.
Here is my configuation for debugging:
PS: I haven´t installed anything related to ZEND. Is it necessary ? Here is a error I get when using the Zend Debugger option:
Help appreciated!!! Hope this will be basic learning for solving...
To debug on zend debugger, you need zend debugger installed.
For xdebug remote debugging (browser run) you have to enable dbgp protocol:
https://wiki.eclipse.org/Debugging_using_XDebug#Configuration
I'm currently running Komodo 7 and have XDebug set up on PHP 5.3.1, which is installed as part of XAMPP 1.7.3. All of this is running on Mac OS X 10.7.
Until I upgraded XAMPP (from version 1.0.1) step-through debugging of PHP in Komodo was working fine. I'd load a page in Firefox and the Komodo icon in the dock would start bouncing up and down, and I'd be able to step through my code, add breakpoints, etc.
It now seems that debugging isn't working properly. I'm confident that XDebug is set up properly, as it shows up when I run phpinfo(). However, when I load a page in Firefox, step-through debugging doesn't start in Komodo. Komodo does respond to an extent, in that information is displayed in the "Debug Output" pane in the bottom-right of the Komodo window, but there's no way I can see to start step-through debugging.
I've got a project I need to finish, so I'd really appreciate any help anyone is able to offer.
As per Hamish's comment above, this is indeed a duplicate (of sorts) of Can't get PHP debugging to work with Komodo (but I'm almost there!)
See that question for something approaching an answer.
I am using Eclipse with below configuration on Mac
Eclipse SDK
Version: 3.7.0
Build id: I20110613-1736
...
PHP Development Tools (PDT) SDK Feature 3.0.0.v20110516-1100
...
Zend Debugger Feature 5.3.18.v20110322
It was working perfectly fine till I had Mac Snow Leopard but as soon as I upgraded to Mac Lion, Eclipse has stopped encountering any breakpoints and PHP web page execution goes till end and terminates.
Nothing has changed after that I tried to update the eclipse/pdt/zend debugger but did not find any updates.
Any help will be appreciated.
I had the same problem when trying to get the debugger to work on Eclipse in OSX Lion.
Eventually gave up and tried another IDE, Netbeans.
Hope you find a solution
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.
Is it possible to debug PHP projects on Glashfish with NetBeans 6.8 without installing Apache server?
After I press CTRL+F5 im getting 404 not found error.
As ASP.NET developer I have (I think) similiar developer server bundled with Visual Studio, so there is no need to install any other server like IIS. Am I right that Glassfish is similiar developer server, so why Im getting 404?
Thanks
Darek
From Netbeans page.
To successfully debug PHP applications in the NetBeans IDE for PHP, you need to have the PHP engine, the Apache local web server, and the XDebug debugger installed and configured for PHP development. If you have difficulties getting XDebug to work, see the NetBeans wiki on XDebug and/or ask the community at users#php.netbeans.org.
I hope it helps