I am trying to get PHPStorm to talk to Xdebug, and am having very little luck.
Here is my setup:
I have a VM which shares my php files from my local machine
I am trying to follow this:
http://blog.jetbrains.com/webide/2011/02/zero-configuration-debugging-with-xdebug-and-phpstorm-2-0/
I put the following in my php.ini
zend_extension = /usr/lib64/php/modules/xdebug.so
xdebug.remote_connect_back = 1
xdebug.remote_enable = 1
xdebug.remote_handler = dbgp
xdebug.remote_mode = req
xdebug.remote_port = 9000
xdebug.remote_host = <my ip address>
xdebug.remote_log = /tmp/xdebug_remote.log
It appears I successfully got xdebug running according to phpinfo().
I open my script, turn on the listener. But when I get to the "Activate debugger on server" portion of the tutorial, things fall apart. I download the firefox addon to start the debugger(this one: https://addons.mozilla.org/en-US/firefox/addon/easy-xdebug/), click the icon to start the debugger, reload the page, but phpstorm does not find it. I also tried adding XDEBUG_SESSION_START=1 as a POST value yet still no luck.
What am I doing wrong?
You want your remote_host to be the ip address that the vm sees on your localhost. It's not the IP address you get from your ISP.
Related
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.
I have a Virtual Machine set up by Vagrant. It's Centos 7. Besides Apache and mod_php I installed xDebug and its configurations looks like this:
[xdebug]
zend_extension="/usr/lib64/php/modules/xdebug.so"
xdebug.remote_enable = On
xdebug.remote_autostart = On
xdebug.remote_handler = dbgp
xdebug.remote_port = 9000
xdebug.remote_mode = req
xdebug.remote_connect_back = On
xdebug.idekey = "netbeans-xdebug"
I set up a virtual host for my project, and when I pull it out in the browser, I get it working. xDebug works perfectly.
Then I want to use Vagrant Share to make my project reachable from the Internet. When I start this service, the site is available via my-temporary-domain.vagrantshare.com. Everything seems working fine. But I'm not able to debug.
What is the problem I cannot see? What should I configure to get xDebug doing its job?
So I figured out the solution.
My guest machine has a static IP 192.168.1.2. My host one -- 192.168.1.1
When I set
xdebug.remote_connect_back = Off
which is default, btw. And make
xdebug.remote_host = 192.168.1.1
it works as expected. I assume it's because of xDebug concept that I didn't completely understand. This article helped:
http://walkah.net/blog/debugging-php-with-vagrant/
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.
i'm using PHPStorm and trying to run Xdebug according this video https://laracasts.com/series/how-to-be-awesome-in-phpstorm/episodes/20?autoplay=true.
First part works perfectly (https://laracasts.com/series/how-to-be-awesome-in-phpstorm/episodes/19?autoplay=true), but i'm stuck at second one.
Port 9000 was not working, so i changed it to 10000.
I configured PHP Web Application configuration
and after I press debug button, web is blank
and still loading and PHPStorm is waiting for incoming connection.
I have checked "can accept external connection" at PHP - Debug - Xdebug and xdebug in php.ini configured like this:
[XDebug]
zend_extension="/usr/local/Cellar/php56-xdebug/2.3.3/xdebug.so"
xdebug.remote_enable = 1
xdebug.cli_color = 1
xdebug.show_local_vars = 1
xdebug.remote_port = 10000
xdebug.remote_host= localhost
xdebug.remote_autostart = 1
xdebug.remote_log="/usr/local/tmp/xdebug.log"
xdebug.idekey = "PHPSTORM"
xdebug.ide_key = "PHPSTORM"
xdebug.profiler_enable = 1
xdebug.profiler_output_dir="/usr/local/tmp/xdebug-profiler"
xdebug.profiler_enable_trigger = 1
I tried to validate web server with this result:
I was googling and trying solve this for 6 hours, try to help me please, i`m kind of dummy in this.
Using OS X El Capitan.
I can debug single script, but not a whole website.
When i run this directly online-chef.dev:10000, it says ERR_CONNECTION_REFUSED.
"online-chef.dev" is at local virtual host.
What I am doing wrong?
Thank you so much!
You are tried to debug web page through xdebug. For debug javascript you need install browser extention. This is manual for javascript debugging.
For javascript debug get current extention port and enter in this place:
For XDebug i don't want always click debug button, so i simple enable listen connections. This is manual for XDebug from JetBrains.
Here is my xdebug config that working with listen connections.
xdebug.idekey = "PHPSTORM"
xdebug.remote_port = 9001
xdebug.remote_mode = "req"
xdebug.remote_host = 10.0.2.2
xdebug.remote_handler = "dbgp"
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
xdebug.extended_info = 1
So, when i need debug javascript i click debug button. When i need debug php i just put breakpoint.
First set up debugging instruments often is hard, but it's pays off.
I use PHPStorm along with Xdebug to step through my code. PHPStorm is running on a Windows 7 machine, and my local webserver is running on a separate CentOS 6.4 machine. I've done a phpinfo(); to verify that Xdebug is being loaded by PHP, and it is. The following are the settings for my Xdebug in the PHP.ini:
[xdebug]
zend_extension="/usr/lib/php/modules/xdebug.so"
xdebug.remote_enable = 1
xdebug.remote_port = 9000
xdebug.remote_host = "192.168.1.130"
xdebug.remote_log = "/var/log/httpd/xdebug_log"
I similarly setup PHPStorm to use my CentOS server as the debugging server, and I listen for connections. I assigned static IPs to both of these machines. Using a Chrome Xdebug plugin to set the appropriate cookies, I attempt to set a breakpoint, but nothing happens. When I go to look in /var/log/httpd/xdebug_log (which has 777 permissions), nothing is written there. I've opened up port 9000, and I can telnet from my CentOS machine back to my Windows machine on port 9000 no problem. I also set SELinux to permissive, but to no avail.
Any ideas what could be happening here?
Try to configure your project in PhpStorm
Open Settings->Languages & Frameworks->PHP->Debug
Uncheck the "Ignore external connections through unregistered server configurations" option
OK
Add to your php.ini:
xdebug.mode=debug
I was having the same issue, below are the steps I performed to resolve it:
Make sure you have xdebug installed and in php.ini uncomment xdebug.mode=debug
Open Settings->Languages & Frameworks->PHP->Debug, Assign Debug Port value, you can find this port from php.ini. In my case, it was 9002
Now Validate debugger configurations - here you need to add the path to your web application files and URL. Click validate.
Now Start Listening -> Enable listening for PHP Debug Connection.
After this setup you can set a break point and start debugging with XDEBUG.
In my case, i added folder that im debugging to exclusive, so it return 502 or blank page when i put breakpoint. Remove exclusive folder and everything working.
You can consider this blog to find more solution: Link.
sudo gedit /etc/php/7.2/mods-available/xdebug.ini
zend_extension=xdebug.so
xdebug.remote_enable = 1
xdebug.remote_port = 9898
xdebug.idekey = “PHPSTORM”
xdebug.show_error_trace = 1
xdebug.remote_autostart = 0
xdebug.mode=debug
xdebug.client_port=9898