Error running PHP: Xdebug port 9000 is busy - xdebug

I set config in PhpStorm to run Xdebug on Docker. Trying to debug PHP script outputs in PhpStorm event log with:
"Error running script.php: Port 9000 is busy"
I change port but didn't work the same problem
-config file xdebug.ini
xdebug.idekey = PHPSTORM
xdebug.remote_enable=1
xdebug.remote_autostart=0
xdebug.remote_connect_back=1
xdebug.remote_host=localhost
xdebug.remote_port=10000
xdebug.remote_log=/tmp/php5-xdebug.log

You need to change the port in the PhpStorm configuration/settings too. It's PhpStorm that needs to open the port and listen, not Xdebug.
And, if you're using PHP-FPM, it already has the port 9000 open, as they unfortunately choose the same port.

Related

Debugging remote (DigitalOcean) Lando site (drupal8 recipe) with PHPStorm + Xdebug

I'm trying to run Lando remotely to avoid consuming local resources. Sometimes I need to work on a laptop and lando+xdebug is a hungry beast.
Local
I don't have Lando running locally. I'm synchronizing my files using PHPStorm and Lando is running remotely.
Remote
I have a DigitalOcean droplet set up and running a Lando (drupal8) site. I can access the site and it's running as normal at:
http://165.xxx.xxx.xxx:ppppp
165.xxx.xxx.xxx, being the IP of the droplet and
ppppp, being the port that Lando (docker) exposes the container
.lando.yml
name: XXXXXX
recipe: drupal8
config:
php: 7.1
webroot: ./docroot
xdebug: false // overridden later
services:
appserver:
build:
- composer install
ruby:
type: ruby:2.4
run:
- "cd $LANDO_MOUNT && gem install compass"
tooling:
blt:
service: appserver
cmd: /app/vendor/acquia/blt/bin/blt
gem:
service: ruby
compass:
service: ruby
fix-compass:
service: ruby
cmd: "gem install compass"
.lando.local.yml
Since I don't want this config for my fellow developers
config:
xdebug: true
config:
php: .lando.php.ini
.lando.php.ini
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
xdebug.remote_connect_back = 0
xdebug.remote_host = localhost
xdebug.remote_port = 9002
xdebug.remote_log = /xdebug.log
xdebug.remote_mode = req
xdebug.idekey = PHPSTORM
PHPStorm Server
Host: localhost
Port: 9002
Debugger: Xdebug
Use path mappings (checked)
-- project --> /app
Steps I take to run this
Start listening for debug connections in PHPStorm
Create SSH tunnel with ssh -R 9002:localhost:9002 root#165.xxx.xxx.xxx
Refresh http://165.xxx.xxx.xxx:ppppp
Findings
Using lando php -i, I can see that xdebug is running (and all of my php.ini config is set) as it should, on port 9002.
Using nc -z localhost 9002 || echo 'no tunnel open', I can also tell that SSH tunnel is open for 9002, as it should be.
I don't get any prompt for incoming connections
Update:
Some progress when I forced 9002 open with:
sudo iptables -A INPUT -p tcp -d 0/0 -s 0/0 --dport 9002 -j ACCEPT
However, now I get this error
Log opened at 2019-08-20 02:54:17
I: Connecting to configured address/port: 165.xxx.xxx.xxx:9002.
W: Creating socket for '165.xxx.xxx.xxx:9002', poll success, but error: Operation now in progress (29).
E: Could not connect to client. :-(
Log closed at 2019-08-20 02:54:17
So I've been experiencing this a few times this year. I originally solved this a few weeks ago by upgrading PHPSTORM from 2018.1 to 2019.1. It was indicated to me (on some thread on the internet) that the XML schema for the next version of xdebug was different. It worked immediately after updating. It seems though that this broke again in 2019.2.
The last time I got this to work was 2019.1.3. Best of luck!
Update: As I've continued to update both storm and php/xdebug, I've found that this has stabilized. It was all over the place for a while.

Netbeans Xdebug Windows 10 waiting for connection

Netbeans 8.2 I get the dreaded "waiting for connection"
I know the setup is correct because I have
Loaded the correct version of the xdebug extension uising the official flow chart method.
The port forwarding is correctly specified from my PC to port 9000
my php.ini file has the following settings
xdebug.remote_connect_back=1
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_port=9000
xdebug.idekey="netbeans-xdebug"
output_buffering=Off
In Nebeans Options / PHP / Debugging the port is 9000 and the session ID is netbeans-xdebug
After a lot of investigation, I turned off the Windows Defender "Private" Firewall and Netbeans Xdebug worked i.e. stopped "waiting for connection" and went to the appropriate line in the code.
There is a Netbeans IDE rule for TCP in the incoming firewall, but it is only set for public, it needs to be set for private as well.
Hope that helps someone

Setting up phpstorm with xdebug

I have been trying to set up remote (virtual box server) debugging with phpstorm. When I press the debug button phpstorm just waits indefinitely for a connection. I've been looking for a solution for a couple days, and cannot get any varying results.
These are my phpstorm settings:
Host: mywebsite.dev
Port: 9000
Debugger: Xdebug
pathmapping: /public <--> /index.php
These are my xdebug params in php.ini
xdebug.remote_enable=on
xdebug.remote_autostart=off
xdebug.remote_handler=dbgp
xdebug.remote_connect_back=on
xdebug.remote_port=9000
xdebug.default_enable=on
xdebug.remote_mode=req
xdebug.remote_log=/var/log/xdebug/xdebug.log
Please let me know if you need anymore information. Thanks in advance!
This tutorial worked for me in Ubuntu
http://confluence.jetbrains.com/display/PhpStorm/Xdebug+Installation+Guide
I notice your php.ini looks a bit different. Here is mine :
[Xdebug]
zend_extension=<full_path_to_xdebug_extension>
xdebug.remote_enable=1
xdebug.remote_host=<the host where PhpStorm is running (relative to your site!)>
xdebug.remote_port=9000
And that was it.
Answering an old post for the heck of it...
You also need to edit you 20-xdebug.ini file
sudo nano /etc/php5/conf.d/20-xdebug.ini
The line zend_extension=xdebug.so should already be there. Add the following lines :
zend_extension=xdebug.so
xdebug.remote_enable = 1
xdebug.remote_connect_back = 1
xdebug.remote_port = 9000
xdebug.scream=0
xdebug.cli_color=1
xdebug.show_local_vars=1
There might be path mapping issues as well.
If you go in run|web server debug validation … do you get error messages ? If so, that’s a clue to what you still need to solve.
You also have to set the key to your xdebug extension in your browser.

Cannot debug with PhpStorm + Vagrant + XDebug

I cannot get XDebug to work with PhpStorm and Vagrant on a Windows 7 machine. I've already followed every tutorial on getting this to work but with no luck.
So what I've tried is:
PhpStorm always listens to debug connections
xdebug.ini file with the following:
zend_extension = "..../xdebug.so"
xdebug.remote_enable= 1
xdebug.remote_handler=dbgp
xdebug.remote_host= 33.33.33.10
xdebug.remote_port= 9000
xdebug.remote_connect_back= 1
xdebug.remote_autostart= 1
xdebug.remote_log = "...."
Setup PhpStorm to connect to localhost:8080 and too 33.33.33.10, both with no luck.
The log file always outputs:
I: Checking remote connect back address.
W: Remote address not found, connecting to configured address/port: 33.33.33.10:9000. :-|
E: Could not connect to client. :-(
The firewall (ESET Smart Security) is always turned-off when I try to debug
Set path mappings, didn't work either
I just don't know what to do, but I really NEED to be able to debug.
Thanks for your help!
The problem was very stupid - I forwarded port 9000 in the Vagrantfile, and I didn't have to do so...
Now, actually I see that the only necessary lines in xdebug.ini are:
zend_extension = ...
xdebug.remote_enable = on
xdebug.remote_connect_back = on
The setup is pretty straightforward, if you don't do stupid things...
Make sure you connect to the right url from within PHPStorm. My vagrant box has the ip of 192.168.50.2 for instance, so i have to set the url of my project => 192.168.50.2
I had to set
xdebug.remote_connect_back = '0'
xdebug.remote_host= '10.0.2.2'
so my whole config looks like this:
xdebug.default_enable: '1'
xdebug.remote_autostart: '1'
xdebug.remote_connect_back: '0'
xdebug.remote_enable: '1'
xdebug.remote_handler: dbgp
xdebug.remote_host: '10.0.2.2'
xdebug.max_nesting_level: '400'
Host: Linux
VM: Vagrant with PuPHPet using VirtualBox
nothing special to configure in PhpStorm
found it here: http://jeromejaglale.com/doc/php/xdebug_vagrant_puphpet_phpstorm

Deploy a project in tomcat 6

I'm trying to deploy a war file onto my server which is tomcat 6 and it runs on a linux machine. My project runs if i give the url with the port number eg: http://192.168.1.8:8080/uctc but it fails to run if i run it without the port number eg ://192.168.1.8/uctc ...can anyone tell me how to run my website without the port number??
8080 is default tomcat port, so configure your tomcat server to use 80 port other than 8080.
see: http://www.klawitter.de/tomcat80.html
Check in server.xml... there is an entry similar to Connector port="8080".. change the 8080 to just 80 and save. Then restart the tomcat service
This is assuming you're not already running another service on port 80 .

Resources