Can't start Xdebug session in PHPStorm - php

I have encounter one problem when I am using PHPStorm 8 under Mac OS, I make some PHP files and I want to debug, but seems my XDebug does not work at all. All my break points just are ignored. I checked my configuration twice and I have tried the online tools on http://xdebug.org/wizard.php
Here's my configuration of my php.ini.
[XDebug]
;zend_extension=opcache.so
zend_extension = /Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20131226/xdebug.so
xdebug.remote_enable=1
xdebug.remote_handler = "dbgp"
xdebug.remote_host = "localhost"
xdebug.remote_mode = "req"
xdebug.remote_port = 9001
xdebug.idekey = "PHPSTORM"
and I also validated on the phpstorm like that.
I don't know why is that? Anybody has any idea?
Jason

Related

How to use visual studio 19 to debug a php app running on an azure Ubuntu VM

I’ve configured the virtual machine, installed apache2, php, MySQL and xdebug. The website works and I’ve configured VS but nothing happens when I debug the project in VS.
Note I have to use a VM because there is some trickery that is being done with open VPN.
I am no expert with PHP as I come from the ASP.NET world and I have never used Xdebug before.
I've been asked to add some additional information but the /etc/php/7.2/apache2/php.ini file is too large to add into this post. If you want some more information please ask for a section and I will post it.
In the mods-available folder is an xdebug.ini file that contains:
zend_extension=xdebug.so
xdebug.remote_autostart = 1
xdebug.remote_enable = 1
xdebug.remote_handler = dbgp
xdebug.remote_host = 127.0.0.1
xdebug.remote_log = /tmp/xdebug_remote.log
xdebug.remote_mode = req
xdebug.remote_port = 9000 #if you want to change the port you can change
I've also set up an inbound rule in Azure for the server to a allow port 9000.
When running VS I have set up the Server URL and specified Xdebug Port 9000.
DBGp proxy is not set.
Thank you
Tim
I finally managed to get something to work.
I updated the xdebug.ini like this:
zend_extension=/usr/lib/php/20170718/xdebug.so
xdebug.remote_autostart = 1
xdebug.remote_connect_back = 1
xdebug.remote_enable = 1
xdebug.remote_handler = dbgp
xdebug.remote_host = 86.180.220.70
xdebug.remote_log = /tmp/xdebug_remote.log
xdebug.remote_mode = req
xdebug.remote_port = 9000 #if you want to change the port you can change
xdebug.idekey = "php-vs"
And, crucially, opened the firewall on my machine for port 9000.
Now I can't seem to set any break points in php that actually hit.
I'm assuming this has something to do with path mapping - plenty of stuff on google for Code but little if nothing for Visual Studio...
I have to say the documentation for doing things like this is SHOCKINGLY bad. Most examples are for a Windows php.ini file, not for Linux. If your a seasoned php programmer your probably used to it but for a newbie like me its an absolute minefield.

Debugging PHP, from NetBeans using XDebug and XAMPP

I have followed this document:
This is my php.ini
[XDebug]
zend_extension="C:\xampp\php\ext\php_xdebug.dll"
xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = 1
xdebug.remote_enable = 1
xdebug.remote_host = "localhost"
xdebug.remote_handler = "dbgp"
xdebug.remote_mode = "req"
xdebug.remote_port = 9000
I am running Apache using XAMPP on port 9000:
from NetBeans when I do: Debug -> Debug Project
I get the following:
Port 9,000 is already in occupied. Configure the IDE to use another
port?
XAMPP is the software that is using port 9000 thousand. What do I need to do here? Should I change the XDebug port to 9001? Tools -> Options:
If I do this, I would also need to change php.ini and change the XDebug port to 9001.
Or should I keep using port 9000? I have been different settings, but not able to hit my break point.
I have been using Netbeans for years to code PHP and xdebug has always been a pain. I cant even give you any pointers.
But I switched last year to VS code and I can honestly say that it improved my code, and xdebug is actually easy to connect, and fun to use.
I recommend you give it a try.
This is how I got the debugger running:
When prompted with:
Port 9,000 is already occupied Configure the IDE to use another port?
Click Yes (alternatively you can open the setting from Tools -> Options: Choose PHP -> Debugging)
Set debugger Port to 9001.
update php.ini to have port 9001
[XDebug]
zend_extension="C:\xampp\php\ext\php_xdebug.dll"
xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = 1
xdebug.remote_enable = 1
xdebug.remote_host = "localhost"
xdebug.remote_handler = "dbgp"
xdebug.remote_mode = "req"
xdebug.remote_port = 9001
Restart XAMPP

How to enable memory monitoring in Xdebug?

I am trying to use Xdebug for my Drupal project debugging. In some documentations, I saw that the Xdebug is able to find memory leaks as well. I tried to use that facility. But I am not getting any logs regarding that.
I configured my 20-xdebug.ini as follows
zend_extension=xdebug.so
xdebug.remote_enable=1
xdebug.remote_host = 127.0.0.1
xdebug.remote_enable = 1
xdebug.remote_port = 9000
xdebug.remote_handler = dbgp
xdebug.remote_mode = req
xdebug.profiler_enable=0
xdebug.profiler_enable_trigger=1
xdebug.profiler_output_dir = "/home/myname/Desktop/xdebug/"
xdebug.trace_output_dir="/home/myname/Desktop/xdebug/"
xdebug.remote_log="/home/myname/Desktop/xdebug/xdebug.log"
xdebug.auto_trace=1
xdebug.collect_params=1
xdebug.trace_format=1
xdebug.idekey=netbeans-xdebug
xdebug.remote_autostart=1
I am able to connect NetBeans with Xdebug and I can go through each break points. But there are no logs regarding this in the /tmp folder and there are no log files in the above given paths as well.
Am I doing something wrong? Please assist me on this.
maybe you need
xdebug.show_mem_delta = 1
xdebug.show_mem_delta
Type: integer, Default value: 0
When this setting is set to something != 0 Xdebug's human-readable
generated trace files will show the difference in memory usage between
function calls. If Xdebug is configured to generate computer-readable
trace files then they will always show this information.

Waiting for connection(netbeans-xDebug)-php-XAMPP

I tried to use netbeans to debug php program. And the xdebug is not working. What I have tried is
Go to http://xdebug.org/wizard.php to analyse my phpinfo() .
I downloaded php_xdebug-2.4.0rc2-5.6-vc11.dll and put it into C:\xampp\php\ext
I also modified php.ini(I am sure it is the correct file) like
zend_extension = "C:\xampp\php\ext\php_xdebug-2.4.0rc2-5.6-vc11.dll"
xdebug.profiler_append = 0
xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = 0
xdebug.profiler_output_dir = "C:\xampp\tmp"
xdebug.profiler_output_name = "cachegrind.out.%t-%s"
xdebug.remote_enable = 1
xdebug.remote_handler = "dbgp"
xdebug.remote_host = "127.0.0.1"
xdebug.remote_port = 9000
xdebug.remote_autostart = 1
xdebug.remote_connect_back = 1
I also checked port 9000. When netbeans does not debug, I enter netstat -ano | find "9000" from cmd. It comes nothing. While I start debuging throuh netbeans, it comes as the picture below
So I thought that the netbeans can interactive with xDebug through port 9000 properly.
The problem might be ip address. So I try to use my ipv4 address(cmd-ipconfig) instead of 127.0.0.1,not working. And also "localhost", not working neither.
I realize that I am working on the university with vpn and maybe the problem comes from firegate or antivirus software. But I can not shut down any of them because I am not the system administrator.
How to deal with this situation? Any help?
I spent entire day for this.
Problem solved. I tried all but nothing works. Finally I unistalled XAMPP and followed the steps from http://xdebug.org/wizard.php. My final xDebug part in php.ini file is(only uncommented content)
[XDebug]
zend_extension = "C:\xampp\php\ext\php_xdebug-2.4.0rc2-5.6-vc11.dll"
xdebug.remote_enable = 1
xdebug.remote_handler = "dbgp"
xdebug.remote_host = "127.0.0.1"
xdebug.remote_port=9000
I thought my problem casued by the configuration in apach server. Because the first time when I wanted to start Apach server from XAMPP control panel, it said error because of port block. So I changed the port number instead of using the default port. And after I reinstalled the XAMPP control panel, I restarted the computer and started Apach server immediatelty to make sure nothing else occupied the port. And all works great. So it might be the problem. Hope useful.

Installing Xdebug in Eclipse on Mac

I am struggling all day long to get Xdebug working on Eclipse Helios for php on my Mac. I have rewritten my php.ini file which is located at /Applications/MAMP/bin/php/php5.5.3/conf/php.ini as follows;
zend_extension="/Applications/MAMP/bin/php/php5.5.3/lib/php/extensions/no-debug-non-zts- 20121212/xdebug.so"
xdebug.remote_enable = On
xdebug.remote_handler = dbgp
xdebug.remote_mode = req
xdebug.remote_host = localhost
xdebug.remote_port = 9000
xdebug.idekey =
xdebug.profiler_enable = On
xdebug.profiler_output_dir = “/Applications/MAMP/tmp/xdebug/”
Also, I have Komodo-PHPRemoteDubgging and replaced xdebug.so file in /Applications/MAMP/bin/php/php5.5.3/lib/php/extensions/no-debug-non-zts-20121212/xdebug.so
If I look into phpInfo() I can find the term Xdebug.
Still, when I try to run my web app on eclipse at debug mode, it stops at 57%.
Can somebody help me out on this?
Okay, I think I got the answer to my own question. I have replaced the contents under [xdebug] in the php.ini file with the below contents;
[xdebug]
zend_extension="/Applications/MAMP/bin/php/php5.5.3/lib/php/extensions/no-debug-non-zts-20121212/xdebug.so"
xdebug.remote_enable=On
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_autostart=Off
xdebug.profiler_enable = On
xdebug.profiler_dir = “/Applications/MAMP/tmp”
xdebug.collect_vars=on
xdebug.collect_params=4
xdebug.dump_globals=on
xdebug.dump.GET=*
xdebug.dump.POST=*
xdebug.show_local_vars=on
I have no idea what the difference is, but now it finally seems to work.

Categories