I can't debug Symfony 3 with Netbeans.
I performed the following steps:
1) I installed php5-xdebug on ubuntu
2) I modified the php.ini file as follows:
zend_extension="/usr/lib/php5/20121212/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.max_nesting_level=300
3) I restarted apache
4) On Netbeans I set Run Configuration->Advanced->Do not Open Web Browser
5) I installed the easy Xdebug add-on for Firefox
6) I start the application with the console command php bin/console server:start
7) I put the breakpoint on the controller action with Netbeans
8) I start debug with Netbeans
9) I go on the url http://127.0.0.1:8000/shifts/1?XDEBUG_SESSION_START=netbeans-xdebug
Q - The page will load normally and debugging does not go on the breakpoint. Where am I wrong?
thanks
In order to debug your application using the PHP's built-in server follow the following steps:
In the tab "Projects" right-click on the project you wish to debug.
In the "Categories" list choose "Run Configuration".
In the "Run As" select box choose "PhP Built-in Web Server (running on built in web server)".
Add your Hostname and Port and press "OK".
Done with NetBeans IDE 8.2
Related
I've installed PhpStorm hoping to debug a WordPress site running on my workstation on top of Local (https://localwp.com), which comes with an "Xdebug + PhpStorm" plugin I have installed.
The "zero configuration" has not worked for me. I set breakpoints and request a page in the browser but the breakpoints never get hit.
What else do I need to make this work?
Appendix I
PHP version 7.3.5
PhpStorm 2020.1.3
php.ini
[xdebug]
zend_extension = /Applications/Local.app/Contents/Resources/extraResources/lightning-services/php-7.3.5+8/bin/darwin/lib/php/extensions/no-debug-non-zts-20180731/xdebug.so
xdebug.remote_enable=1
xdebug.remote_connect_back=Off
xdebug.remote_port="9000"
xdebug.profiler_enable=0
In order for PhpStorm / Local / Xdebug combo to work, you'll need to
Start Local
Install the addon for Xdebug from within Local
Restart Local
Start a site in Local (ie test)
Go to Utilities and click "Add run configuration to PhpStorm" (ignore the error that'll pop up)
Start PhpStorm and open ~/Local Sites/test/app/public/app/public . THAT'S IMPORTANT to open the public folder (that contains your WP root)
You'll see a "LOCAL" xdebug dropdown on the top right in PhpStorm
You're all set!
open /app/public from within PhpStorm
I have a PHP file and I want to debug that file in Eclipse. I have heard about Xdebug as the best way to debug a PHP file in Eclipse.
What are the steps needed to be able to debug PHP files in Eclipse? I am using Windows OS.
Download PHP for eclipse (PLUGIN eclipse)
Use update URL
https://download.eclipse.org/tools/pdt/updates/7.0
Download XAMPP for windows and install it
https://www.apachefriends.org/es/download.html
Now you can follow alternative instructions here or continue to the next point where i explain what you need to do.
http://robsnotebook.com/php_debugger_pdt_xdebug
After installing XAMPP you should start Apache
Download Xdebug e.g http://xdebug.org/files/php_xdebug-2.9.2-7.2-vc15-x86_64.dll and check if it is correctly installed. Follow next instructions
1. Download php_xdebug-2.9.2-7.2-vc15-x86_64.dll.
2. Move the downloaded file to C:\xampp\php\ext
3. Update C:\xampp\php\php.ini and change the lines
[XDebug]
;; Only Zend OR (!) XDebug
; zend_extension_ts="C:\xampp\php\ext\php_xdebug.dll"
; Modify the filename below to reflect the .dll version of your xdebug
zend_extension = C:\xampp\php\ext\php_xdebug-2.9.2-7.2-vc15-x86_64.dll
xdebug.remote_enable=true
xdebug.remote_host=127.0.0.1 ; if debugging on remote server,
; put client IP here
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.profiler_enable=0
xdebug.profiler_output_dir="C:\xampp\tmp"
4. Restart the XAMPP webserver in your XAMPP control Panel
Comment out any Zend Optimizer in php.ini because it is not compatible with XDebug. For example, all of this should be commented out (using “;”):
[Zend]
; zend_extension_ts = "C:\xampp\php\zendOptimizer\lib\ZendExtensionManager.dll"
; zend_extension_manager.optimizer_ts = "C:\xampp\php\zendOptimizer\lib\Optimizer"
; zend_optimizer.enable_loader = 0
; zend_optimizer.optimization_level=15
;zend_optimizer.license_path =
Check that it is working with phpinfo. You go to your browser and go to:
http://localhost/dashboard/phpinfo.php
Or create in your c:/xampp/htdocs
A file calling phpinfo e.g.
http://localhost/phpinfocall.php
Configuration PHP debug in eclipse
You can create a PHP project. That project should be pointint to C:\xampp\htdocs
The C:\xampp\htdocs is the localserver root folder in xampp. Inside you can create subfolders.
Configure PHP Preference of eclipse
Connect eclipse with php parser of xampp
Configure this and check that xdebug is detected in eclipse from xampp
How to create a debug view from a PHP file in your project
Debug view configuration below,
Lastly, you will see in the debug perspective, that the debugger stop automatically on the first line of your php file.
I need to debug my Laravel application and as I searched Xdebug seemed to be the best option out there. Up to now I couldn't setup a session to the debug my app and I'm confused about how to configure the ambient.
So I run my Laravel app with:
php artisan serve --port=8001
According to my php --ini, the conf file for xdebug is:
$ php --ini | grep xdebug
/etc/php/7.2/cli/conf.d/20-xdebug.ini
which contains:
$ cat /etc/php/7.2/cli/conf.d/20-xdebug.ini
[xdebug]
zend_extension=xdebug.so
xdebug.remote_autostart=on
xdebug.remote_enable=on
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.idekey=default
and to debug it on gedit, I've installed this plugin. And in the text editor settings for dbgp:
Can anyone explain to me exactly how this protocol works? If I click "start to listen to debug sessions" it tries to open one on port 8001 (not 9000) which is already in use and of course it cannot open and if it's the case that I must start my PHP app in conjunction with Xdebug then how do I setup it to run it with the default Laravel command (php artisan serve)?
And, if I click Start debug in Picture related, it opens in the browser with the exact URL http://127.0.0.1/?XDEBUG_SESSION_START=default (in port 80)
During the development on a Symfony 3.3 project I use the Symfony's internal server as seen there But I cannot figure out how to use the xdebug in order to debug it. I mean I have installed and configured xdebug via:
apt-get install php-xdebug
And I export:
export XDEBUG_CONFIG="idekey=phpstorm"
But when I put a breakpoint to my IDE and I enable the xdebug via that plugin I still get no response.
Also I have put the following settings on /etc/php/7.0/mods-available/xdebug.ini
zend_extension=xdebug.so
xdebug.remote_enable=On
xdebug.remote_autostart=On
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9021
xdebug.remote_mode=req
And I have configured both PhpStorm to listen over port 9021. But I still get the problem that I cannot make PhpStorm to listen over a breakpoint.
Do you fellows have any sort of idea how I can fix that over my ubuntu-16.04 machine?
Furthermore I have looked on these questions without any success:
Xdebug configuration with PHP fastcgi and eclipse?
Is it possible to use Xdebug with the built in PHP test server?
EDIT 1
I also tried to export the following:
export XDEBUG_CONFIG="idekey=PHPSTORM"
An configuring the Firefox plugin but still get the very same behaviour. Also keep in mind that I made the PhpStorm to listen over xdebug by pressing the button.
EDIT 2
I also put the following configuration over my PhpStorm:
Still does not work.
In the end the following steps are needed:
Put the following content into: /etc/php/7.0/mods-available/xdebug.ini
zend_extension=xdebug.so
xdebug.remote_enable=On
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9021
xdebug.remote_mode=req
Export:
export XDEBUG_CONFIG="idekey=PHPSTORM"
Then configure PhpStorm as the image shows.
Set as IDE key PHPSTORM into the Firefox plugin
Enable xdebug on Firefox via pressing the button. Alternatively you can append the url with ?XDEBUG_START part
Then press the button in PhpStorm. In case you see the then press it back again.
NOTE:
In case you change xdebug settings TERMINATE the xdebug session by pressing button and pressing back again.
Furthermore in case you run composer via terminal disable PhpStorm to listen xdebug by pressing button.
I can't get my PhpStorm IDE to work with xdebug.
My current setup is the following:
PhpStorm 2017.1.4
MacOS Sierra 10.12.5
Here are the steps that I followed.
I have installed php with the following command. I have added the postgres parameter because I need it later to connect to a PostgreSQL database.
brew install php71 --with-postgresql
The next step is to install XDebug with the following command
brew install php71-xdebug
So the next step that I got from the documentation (https://www.jetbrains.com/help/phpstorm/configuring-xdebug.html) is to edit the php.ini file with the following content:
[Xdebug]
zend_extension="<path to php_xdebug.dll>"
xdebug.remote_enable=1
xdebug.remote_port="<the port for Xdebug to listen to>" (the default port is 9000)
xdebug.profiler_enable=1
xdebug.profiler_output_dir="<AMP home\tmp>"
Just some questions about those fields and XDebug.
So I guess XDebug is some kind of service that runs on the remote_port and that PhpStorm is using to write data to? Or do you have to specify the port where the application you want to test is running?
What exactly is the profiler thing? And can the output dir be anything I can choose?
So this is my php.ini file that I think it should be:
[xdebug]
zend_extension="/usr/local/Cellar/php71-xdebug/2.5.4/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.profiler_enable=1
xdebug.profiler_output_dir="/usr/tmp"
That's it for the php.ini. So I have to check the settings in my PhpStorm IDE. And those are the following:
So that is my setup. In my project I just have one index.php with <?php echo phpinfo(); ?> I just click the Chrome icon so it opens directly in the browser to check if XDebug is there. I see the following result.
So I thought to myself ok let's try some debugging. So I changed my index.php file to the following
$i = 2;
$j = $i + 2;
echo $j
I've put a breakpoint on the 2nd line. And when I run it, it never stops at the breakpoint. What is needed to do that or am I wrong in my configuration somewhere?
To make Xdebug remote debugging working on your page, you need to set a cookie in your browser, telling the server you want to debug the page, there are many extensions for that, the most known is Xdebug helper in Chrome.
I also suggest you to follow this tutorial Zero-configuration debugging, it is very detailed and clear IMO.
If you still have problems i'll try to help you with pleasure :)