How to configure Xdebug with Laradock and PhpStorm - laravel

I'm trying to configure Xdebug with PhpStorm and Laradock.
I started with this:
https://laradock.io/documentation/#install-xdebug
I can see that Xdebug is working:
php-fpm/xdebug status
with Xdebug v2.9.6, Copyright (c) 2002-2020, by Derick Rethans
This is my PhpStorm config:
I added a breakpoint and the debugger is not stopping.
Can anyone see what I am doing wrong?
My project is in /code/test which is /var/www on the server.
Laradock is in /code/laradock
UPDATE:
Xdebug log shows:
[6] Log opened at 2020-07-10 10:44:55
[6] I: Connecting to configured address/port: host.docker.internal:9000.
[6] E: Time-out connecting to client (Waited: 200 ms). :-(
[6] Log closed at 2020-07-10 10:44:55
Update:
changed ini to this (and port in IDE):
xdebug.remote_host=192.168.68.101
xdebug.remote_connect_back=0
xdebug.remote_port=9001
[6] Log opened at 2020-07-10 12:11:03
[6] I: Connecting to configured address/port: 192.168.68.101:9001.
[6] E: Time-out connecting to client (Waited: 200 ms). :-(
[6] Log closed at 2020-07-10 12:11:04

I got this working, I had to do a couple of things:
Turned my firewall off.
changed my config:
xdebug.remote_host="172.17.0.1" # this is listed under docker0 using ifconfig
xdebug.remote_connect_back=0
xdebug.remote_port=9000
xdebug.idekey=PHPSTORM

Related

Xdebug: There was a problem sending 179 bytes on socket 10: Broken pipe

I'm using PhpStorm on Mac. I'm trying to debug a Laravel application inside the Sail container on the remote Ubuntu server.
Error that I can see from Xdebug inside Sail container is:
[17] Log opened at 2021-09-26 21:24:59.590599
[17] [Step Debug] INFO: Checking remote connect back address.
[17] [Step Debug] INFO: Checking header 'HTTP_X_FORWARDED_FOR'.
[17] [Step Debug] INFO: Client host discovered through HTTP header, connecting to 89.164.145.129:9003.
[17] [Step Debug] WARN: Could not connect to client host discovered through HTTP headers, connecting to configured address/port: host.docker.internal:9003. :-|
[17] [Step Debug] INFO: Connected to debugging client: XXX.XXX.XXX.XXX:9003 (from HTTP_X_FORWARDED_FOR HTTP header), host.docker.internal:9003 (fallback through xdebug.client_host/xdebug.client_port). :-)
[17] [Step Debug] -> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" fileuri="file:///var/www/html/server.php" language="PHP" xdebug:language_version="8.0.5" protocol_version="1.0" appid="17" idekey="phpstorm"><engine version="3.0.4"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[https://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2021 by Derick Rethans]]></copyright></init>
[17] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" status="stopping" reason="ok"></response>
[17] [Step Debug] WARN: 2021-09-26 21:24:59.896494: There was a problem sending 179 bytes on socket 10: Broken pipe.
[17] Log closed at 2021-09-26 21:24:59.898408
I've set up server, SSH tunnel, auto file deployment, Xdebug, and validated in PhpStorm, but I keep getting this error.
The issue is that PhpStorm is listening for debug connections, but retrieves none, debug is not triggered in the IDE.
I had the same issue and this is how I fixed it. I use Idea Intellij, but I guess it is no different.
On Mac:
In Idea Intellij > Pereferences > Lagnuages & Frameworks > PHP > Debug > Xdebug > Debug port.
The value was 9000, 9003 and in my php.ini the debug port was 9003
xdebug.client_port="9003"
so I change the port to be only 9003 and it worked!
Thanks a lot! Really cost me two hours. Not so helpful error messages of PHPSTORM. It worked for webbased debugging but CLI no way.
Confusing that the PHPUNIT CLI session starts with only the first port noted in the preferences as a CLI config argument. That way it got to the wrong port as I still had 9000 (xdebug v2) and 9003 (v3) noted, which worked for webbased debugging...
Thus: PHPSTORM should not make it possible to listen to more ports, or denote clearly that with CLI debugging only the first port get explicitly called as an CLI argument. Which, when using nginx/php-fpm like I do, is not working while port 9000 is taken by php-fpm.
I was debugging PHP in one Docker container and came to a point where a subsequent request was sent to another Docker container.
The subsequent request didn't start even if XDEBUG is properly configured on the second Docker container. xdebug.log contains:
[161] [Step Debug] WARN: 2022-09-02 19:59:34.526179: There was a problem sending 179 bytes on socket 7: Broken pipe.
After hours of debugging I found out, that I had to send X-Forwarded-For header:
$response = $guzzle->request(
'POST',
'/my-uri',
[
'form_params' => [
...
],
'headers' => [
'X-Forwarded-For' => $_SERVER['HTTP_X_FORWARDED_FOR']
]
]
);
php.ini xdebug config:
xdebug.client_host=host.docker.internal
xdebug.client_port=9000
xdebug.mode=debug
xdebug.start_with_request=1
xdebug.discover_client_host=1
I hope this will save somebody some time.

I am trying to remote debug spring MVC application hosted on Ubuntu server from my intellij IDE on MAC

i started the tomcat by setting below two in setenv.sh file under TOMCAT_HOME/bin/
export JPDA_ADDRESS="5005"
export JPDA_TRANSPORT="dt_socket"
startd server using sudo ./catalina.sh jpda run the output log says
Listening for transport dt_socket at address: 5005
Created a new remote configuration from edit_configuration and added host name and port start debug and got below error.
5:35 PM Error running 'Remote_Debugging': Unable to open debugger port (xxxxxxxxxx.xxx:5005): java.net.ConnectException "Connection refused (Connection refused)"
thanks in advance.

Xdebug 2.7.0 does not work on PhpStorm with Laravel Homestead

I try to make Xdebug work on my machine for over a month now and its driving me crazy. I have the following configuration:
A Vagrant box with Laravel Homestead (PHP 7.3, Xdebug 2.7.0rc1 on Ubuntu 18.04.1)
On my own computer I have the most recent version of PhpStorm. I've checked the settings for over 10 times now, so I can dream them. The settings of the remote CLI Interpreter are
I also have some settings in the PHP > Servers dialog
When I want to be sure that PHP loads the extensions I use the command php -i | grep xdebug with the result
vagrant#vrfy:~$ php -i | grep xdebug
/etc/php/7.3/cli/conf.d/20-xdebug.ini,
xdebug
...
xdebug.idekey => no value => no value
...
xdebug.remote_enable => On => On
...
xdebug.remote_host => 192.168.10.1 => 192.168.10.1
...
xdebug.remote_port => 9000 => 9000
Note: I also tried to use PHPSTORM as the ide key.
As you can see.
Xdebug is installed on the VM
PhpStorm knows how to reach the VM with xdebug (validation succeeded)
What am I doing wrong?
EDIT: Phpinfo with xdebug
xdebug log
[31052] Log opened at 2019-04-05 12:50:48
[31052] I: Checking remote connect back address.
[31052] I: Checking header 'HTTP_X_FORWARDED_FOR'.
[31052] I: Checking header 'REMOTE_ADDR'.
[31052] I: Remote address found, connecting to 192.168.10.1:9000.
[31052] E: Time-out connecting to client (Waited: 200 ms). :-(
[31052] Log closed at 2019-04-05 12:50:48
[31052]
[31052] Log opened at 2019-04-05 12:50:49
[31052] I: Checking remote connect back address.
[31052] I: Checking header 'HTTP_X_FORWARDED_FOR'.
[31052] I: Checking header 'REMOTE_ADDR'.
[31052] I: Remote address found, connecting to 192.168.10.1:9000.
[31052] E: Time-out connecting to client (Waited: 200 ms). :-(
[31052] Log closed at 2019-04-05 12:50:49
[31052]

Unable to get Xdebug working with EC2 server

I'm attempting to get Xdebug connecting to my PhpStorm from an EC2 instance.
I have opened up port 9000 on the security group tied to the EC2 instance.
Prior to opening it up with UDP, I would get:
telnet: connect to address <IP>: Connection refused
telnet: Unable to connect to remote host```
After opening it up, I get:
Trying <IP>... and it just hangs there.
I port forwarded 9020 internally to 9000 externally to see if that would give any different results (since I can't find a setting on the router for simply opening up ports)
My xdebug.ini setting is located at: /etc/php-5.6.d/50-xdebug.ini (yes, very old version of PHP that I have to work with here).
My xdebug.ini contains this:
xdebug.remote_autostart=on
xdebug.remote_enable=on
xdebug.idekey=PHPSTORM
xdebug.remote_connect_back = On
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.remote_mode = req
I'm using PhpStorm, and have it listening on port 9020 now (tried 9000 prior to port forwarding with the same result).
I have the Xdebug browser extension installed and have it set to PHPSTORM.
I have stop on first line turned on, as well as breakpoints just in case.
Xdebug is set to listen.
When I hit the PHP page from my browser, nothing happens. I've had this working dozens of times, but never from an EC2 instance. Any idea what I missed?

socks 5 danted proxy server on centos 7 not open any site

I have a VPS with Centos 7 os
I have installed danted script
wget --no-check-certificate https://raw.github.com/Lozy/danted/master/install.sh -O install.sh
bash install.sh
source : https://github.com/Lozy/danted
but when I test it by proxifier.
[23:14] Starting: Test 1: Connection to the Proxy Server
[23:14] IP Address: 95.216.149.37
[23:14] Connection established
[23:14] Test passed.
[23:14] Starting: Test 2: Connection through the Proxy Server
[23:49] Error : connection to the proxy server was closed unexpectedly.
Please make sure that the proxy server protocol and address are correct.
[23:49] Test failed.
[23:49] Testing Finished.
test step 2 failed
i have done every thing but nothing come to my mind to fix it.
ip: 95.216.149.37 port : 443 user: moh pass: Setaya12

Resources