Xdebug doesn't stop at break points in Symfony project - php

I'm using MAMP free version and PhpStorm
To enable Xdebug in MAMP I've modified 2 php.ini files accordingly to this tutorial:
/Applications/MAMP/conf/php5.6.10/php.ini
/Applications/MAMP/bin/php/php5.6.10/conf/php.ini
Now I'm able to use xdebug in some simple project by listening to PHP debug connections. However if I try to use it in Symfony project, xdebug just ignores break points.
Here is my configuration for Symfony project in PhpStorm:
UPD: Added screenshot of xdebug configuration
UPD2: Added path mappings

I recommend you to try chrome XDEBUG extension. It works fine for me
https://chrome.google.com/webstore/detail/xdebug-helper/eadndfjplgieldjbigjakmdgkmoaaaoc

Related

PHP Xdebug Laravel application in IntelliJ IDEA

Could you please advice me how properly configure Xdebug for Laravel application. I found a lot instructions for PhpStorm but they do not work for me as I'm using IntelliJ IDEA Ultimate.
What I have already achieved - I can debug single PHP script but not whole application. I cannot follow completely the instruction which is given for PhpStorm because on step when I need to configure Run/Debug Configuration I got stucked.
Much appreciation on any help in advance!
Okay, I gathered full instruction how to work with XDebug and IntelliJ Idea Ultimate to debug Laravel application and Windows specifically (if you use other OS the installation part will be different but other should be the same):
First of all you need to install XDebug itself and configure PHP to work with it. For that:
Find out which PHP version you use using phpinfo() you will need Version, Architecture and PHP Extension Build sections to complete next step.
Go to https://xdebug.org/download.php and download appropriate build. Basically it is dll provided for specific PHP you have installed
After that copy that DLL to Apache modules directory - for me that is D:\OSPanel\modules\http\Apache-PHP-7-x64\modules\ as I'm using OpenServer.
Put into php.ini file following configuration:
[Xdebug]
zend_extension="D:\OSPanel\modules\http\Apache-PHP-7-x64\modules\php_xdebug-2.6.0-7.1-vc14-x86_64.dll"
xdebug.remote_enable = 1
xdebug.remote_host = "localhost"
xdebug.remote_autostart=on
xdebug.remote_enable=on
xdebug.remote_port=9000
xdebug.idekey="PHPSTORM"
where php_xdebug-2.6.0-7.1-vc14-x86_64.dll is name of dll I personally downloaded.
Restart Apache
Open your Laravel project and check your Debuggin configuration (File > Settings... > Languages & Frameworks > PHP > Debug): check XDebug section if Debug port is the same as you specified above (it should be, if you did not changet it previously)
Delete all your Run/Debug configurations
Install Xdebug Helper for Chrome or any other extension if your not using Chrome (Browser Debugging Extensions)
Hit Run > Start listening for PHP Debug Connections
Put break point in your project and open appropriate site context
Enjoy!
Hope that will be useful for community.

Unable to setup xdebug for PHP in Intellij

I am trying to setup the debugger using xdebug and IntelliJiDEA 14.0.4 with my PHP application that runs at my localhost for Unit Testing and tracing. i have tried my best but could not able to locate where is the issue.
My phpinfo page shows xdebug support enabled Version 2.4.0.
It is the same version suggested by https://xdebug.org/wizard.php
In IntelliJ I have Run/Debug configrations I have configured "PHP Web Appication" with
Start url - http://localhost:8081/baskar/index.php
Servers - 172.20.65.71 : 9000 xdebug
In Validate remote environment - i have given deployment server as Local and validation script path as C:\dev\baskar\Validation. On validate I am getting
!No php.ini file was found
!No debug extension is loaded
My php.ini file settings:
extension=php_oci8_11g.dll ; Use with Oracle 11gR2 Instant Client
zend_extension=C:/dev/php_5.4/ext/php_xdebug-2.4.0-5.4-vc9.dll
[xdebug] xdebug.remote_enable=true xdebug.remote_port=9000
xdebug.profiler_enable=1 xdebug.remote_host=172.20.65.71
xdebug.profiler_output_dir="C:\dev"
xdebug.remote_log=C:\dev\php_5.4\xdebug.log
Please guide me where I went wrong or let me know if you need anyother info. Thanks in advance!!!
I know this is old, but I would like to provide a generic solution for a very common problem.:
Intellij Ultimate 2018.3 has an excellent Pre-configuracion instructions, with validation (check step 1). Open settings (CTRL+ALT+S) and find it following the selected option in the capture:
Take your time, all you need is in these configurations steps.

XDebug / Apache / PHP / Eclipse skips breakpoints

I'm having problems with XDebug.
Configuration as follows:
Windows 7 64bit
PHP 5.4.6 Thread Safe 32 bit
Apache 2.4 Thread Safe
Eclipse PDT 3.0.2
The problem is that xdebug_break() calls are not working, and breakpoints entered through Eclipse also don't function. I can see that the extension is working, as it appears as a module in phpinfo(). When I call an uncallable method, XDebug outputs the relevant error messages.
I've modified Eclipse's web server path mapping, to no avail.
Here is my php.ini config:
zend_extension = c:/php/php_xdebug-2.2.1-5.4-vc9.dll
xdebug.remote_enable = 1
xdebug.remote_host = localhost
xdebug.remote_port = 8080
xdebug.remote_mode = req
Any help would be kindly appreciated...
First check that what version you are using of PHP in eclipse....
Check it through:
Window->preference->PHP->PHP Interpreter....
Version there should match with the PHP version.....
Reply if problem is not solved....
For all those, that are still fighting with this problem, some handy tips.
Check which version (package) of Eclipse you have? It turns out, that Helios package has some bugs and doesn't stops on breakpoints, when you debug your application as Web Application. Debugging works only, if you run it as PHP Script. Which makes it pretty useless for debugging process.
You should consider either reverting to older Galileo Package Eclipse for PHP Developers or installing newest Eclipse Juno (or even newest developer version of Eclipse Kepler), which doesn't have PDT support build in, but you can easily add it to then, using Help > Install New Software.. (point it to http://download.eclipse.org/tools/pdt/updates/release).
These versions are reported to be able to debug as Web Application, respecting breakpoints.
Also, remember, that Xdebug must be run as Zend Extension in order to support breakpoints! In other words remove extension=xdebug.so (on Linux or xdebug.dll on Windows) line from your php.ini and replace it with zend_extension=/full/path/to/xdebug.so (on Linux or zend_extension=X:\full\path\to\xdebug.dll on Windows). Zend extensions requires full path, even if they're put into /php/ext folder, as regular PHP extensions. You'll find more info on this in Xdebug FAQ (look for an answer to "Xdebug is only loaded as PHP extension and not as a Zend Extension" question).

Unsuccessful XDebug installation

I'm trying to install XDebug on my local machine with Win 7, Apache 2, PHP 5.3.6 TS VC9 build (server manually installed, no package). I've followed instructions at http://xdebug.org/find-binary.php:
I've downloaded dll, moved to dir with other extensions, added following code to C:\Windows\php.ini, restarted server and - in contrary to my expectations - xdebug is neither installed nor listed in phpinfo page.
zend_extension="E:\www\server\php\ext\php_xdebug-2.1.2-5.3-vc9.dll"
Altough I've gone trough my phpinfo and XDebug site several times I still have no idea what can cause this problem. Do you have any suggestions how to get XDebug working please?
Thank you
According to netbeans manual you have to add the xdebug configuration file to the apache php ini directory and not the local php ini directory to make it work with anykind of wamp.
1) http://wiki.netbeans.org/HowToConfigureXDebug
2) Definition of wamp: http://en.wikipedia.org/wiki/WAMP
try zend_extension**_ts**=...
and the in a console fire php -m to see whats in. No need to restart server
I "solved" the problem by updating from 5.3.6 to 5.3.8. I dont know where the problem was, but update and it will work fine. (I used http://xdebug.org/find-binary.php)

debugging php on mac?

was wondering what was the best way to debug PHP on my local machine. I use MAMP on mac os 10.5
thanks,
Patrick
Using xdebug is a good start. Download the package and follow the instructions in the INSTALL file. It's fairly easy. Once this is done, add the following lines to your php.ini file:
;;[xdebug]
zend_extension="/Path/to/your/module/xdebug.so"
xdebug.file_link_format="txmt://open?url=file://%f&line=%1"
xdebug.var_display_max_depth = 20
Don't forget to restart Apache after this.
Most debugging can be done using a simple die(var_dump($some_variable)). It's not very sophisticated, but with xdebug installed, the output of a vardump looks pretty good in a browser. In most of the cases this is enough.
If you need more control, you can add an xdebug_break(); statement in your code and add the following lines to your php.ini:
xdebug.remote_enable=1
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_autostart=1
Again, don't forget to restart Apache.
Now, using a tool like MacGDBp (or Eclipse+PDT if you must), you get a classic debugger. You can step though your program.
Have fun!
I've always thought the "best" way of PHP debugging on any platform is by using FirePHP, which can output debug messages straight into the Firebug window in Firefox.
I've found that running php -l myfile.php is great at catching syntax errors before I try and reload the page in my browser (and thus prevent the abominable White Screen of Death). Beyond that, I just point my browser to my local webserver and try to access the pages.
You can do some nifty things in your code itself (like using debug_backtrace()), but that (obviously) requires you to put it in the code yourself.
Personally, I use Eclipse+PDT and XDebug. To simplify things, get Eclipse for PHP Developers from the Eclipse download page rather than installing PDT as a plugin. Eclipse has a high learning curve, but it gives you all the debugger functionality you expect: instruction stepping, breakpoints, watches, even altering variables live.
If you don't like Eclipse or find it's too much for you, there are other clients compatible with XDebug.
I also use eclipse+pdt and xdebug. If you're new to trying out debuggers you can try zend studio which will setup things pretty easily.
Zend Studio is by far the best tool to use to create and debug PHP code. I run the community Edition of Zend Server on my dev Linux box and locally in a virtual machine on my MacBook Pro.
Take a look at the Zend website for details - it has cut my app development by two thirds!
Thanks to a bunch of links like this one and others, here's a compiled solutions that successfully uses OSX's native Apache2 and XDebug together with MacGDBp and a Safari extension called XDebug Helper.
You can do it even without MAMP.
There is a way how to do it using:
PhpStorm
Homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Php + Xdebug
1) Install php and debug
brew install php70
brew install php70-xdebug
In PhpStorm - check Preferences => Language and Frameworks => PHP
Php language level: 7
Interpreter: PHP 7.0.8 + XDebug (or choose from [...])
Check debug config:
Preferences => Language and Frameworks => PHP => Debug => Xdebug section
All checkboxes should be checked and set Debug port to: 9001
2) run server in your app's directory:
php -S localhost:8080
3) Add localhost:8080 to PhpStorm Preferences => Language and Frameworks => PHP => Servers:
Name: Localhost:8080
Host: localhost
Port: 8080
Debugger: Xdebug
4) Update php.ini:
Php => Interpreter => […] => Configuration file - Open in Editor
Add this section: (check zend_extention path through the cli)
[Xdebug]
zend_extension=/usr/lib/php/extensions/no-debug-non-zts-20121212/xdebug.so
xdebug.remote_enable=1
xdebug.remote_host=localhost
xdebug.remote_port=9001 (same as in Debug preferences)
5) Add Debug Configuration:
Run => Edit Configuration => add - Php Web Application
Choose Localhost:8080 server
6) Click Start Listening for Php Debug Connections
7) Set up breakpoints
7) Click on Debug (Green bug)

Categories