PhpStorm not receiving Xdebug from Vagrant machine - vagrant

I've a Vagrant VM for dev with xdebug installed and I want to connect it to PhpStorm.
In my xdebug.ini I have this:
zend_extension=xdebug.so
xdebug.remote_connect_back = 0
xdebug.idekey = "vagrant"
xdebug.remote_enable=on
xdebug.remote_host=192.168.56.1
xdebug.remote_port=9001
xdebug.remote_log=/tmp/xdebug.log
But it doesn't work. I did some debug and I check that in my host machine the 9001 port was open, and it is:
phpstorm 311 jose 41u IPv4 0x2b62c0b107d1be65 0t0 TCP *:9001 (LISTEN)
phpstorm 311 jose 42u IPv4 0x2b62c0b1056e5245 0t0 TCP *:10137 (LISTEN)
phpstorm 311 jose 143u IPv4 0x2b62c0b10ae27e65 0t0 TCP 127.0.0.1:6942 (LISTEN)
phpstorm 311 jose 168u IPv4 0x2b62c0b107cd875d 0t0 TCP *:20080 (LISTEN)
phpstorm 311 jose 342u IPv4 0x2b62c0b110c70245 0t0 TCP 127.0.0.1:63342 (LISTEN)
JuniperSe 497 jose 10u IPv4 0x2b62c0b10696675d 0t0 TCP 127.0.0.1:3333 (LISTEN)
VBoxHeadl 726 jose 24u IPv4 0x2b62c0b1086e6b3d 0t0 TCP 127.0.0.1:2222 (LISTEN)
VBoxHeadl 726 jose 25u IPv4 0x2b62c0b10fe1d435 0t0 TCP *:33060 (LISTEN)
VBoxHeadl 726 jose 26u IPv4 0x2b62c0b108709435 0t0 TCP *:8088 (LISTEN)
But from Vagrant the 9001 port is not accessible:
nc -z -v -w5 192.168.56.1 9001
nc: connect to 192.168.56.1 port 9001 (tcp) timed out: Operation now in progress
And that's the same for all PhpStorm ports. But I can access 8088 or 33060
nc -z -v -w5 192.168.56.1 8088
Connection to 192.168.56.1 8088 port [tcp/omniorb] succeeded!
I've checked the option to accept external connections in PhpStorm for xdebug. I'm using Mac OS.

Ok, very silly problem. I had the external connections blocked for phpstorm, I changed that in System Preferences > Security > Firewall, on the list of apps I searched phpstorm and allow external connections

Related

ERR_CONNECTION_REFUSED as accessing to the vagrant guest by browser

I'm encountering a title's problem.
vagrantfile
config.vm.network "private_network", ip: "192.168.33.10"
config.vm.synced_folder "./", "/var/www/app",
:owner => "vagrant",
:group => "vagrant",
:mount_options => ["dmode=777,fmode=775"]
httpd.conf
DocumentRoot "/var/www/app/public"
<Directory "/var/www/app/public">
...
procedure
> sudo service httpd start
[ OK ]
access https://192.168.33.10/ by host OS browser.
but ERR_CONNECTION_REFUSED occured
/etc/httpd/log/error_log
no logs about this
/etc/httpd/log/access_log
no logs about this
netstat
> netstat -ant | grep 80
tcp 0 0 :::80 :::* LISTEN
lsof
sudo lsof -i:80
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
httpd 3991 root 4u IPv6 15275 0t0 TCP *:http (LISTEN)
httpd 3994 vagrant 4u IPv6 15275 0t0 TCP *:http (LISTEN)
httpd 3995 vagrant 4u IPv6 15275 0t0 TCP *:http (LISTEN)
httpd 3996 vagrant 4u IPv6 15275 0t0 TCP *:http (LISTEN)
httpd 3997 vagrant 4u IPv6 15275 0t0 TCP *:http (LISTEN)
httpd 3998 vagrant 4u IPv6 15275 0t0 TCP *:http (LISTEN)
httpd 4105 vagrant 4u IPv6 15275 0t0 TCP *:http (LISTEN)
httpd 4107 vagrant 4u IPv6 15275 0t0 TCP *:http (LISTEN)
httpd 4108 vagrant 4u IPv6 15275 0t0 TCP *:http (LISTEN)
service
> sudo service httpd status
httpd (pid 3991) is running...
I have no idea about this.
Could you help me??

How to run Laravel 5.4 on port 80 successfully

I am using a Laravel package to connect to a payment system and this particular package sends and receives data via port 80 (and as I use port 8000 to make payments, I will encounter failures).
As seen here:
How to run laravel 5 on port 80 of localhost?
I decided to give it a try but this error is returned:
Failed to listen on 127.0.0.1:80 (reason: Permission denied)
To discover which program is using port 80, I entered sudo lsof -i :80 and received the following output:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
apache2 3102 root 4u IPv6 46970 0t0 TCP *:http (LISTEN)
apache2 3103 www-data 4u IPv6 46970 0t0 TCP *:http (LISTEN)
apache2 3104 www-data 4u IPv6 46970 0t0 TCP *:http (LISTEN)
apache2 3105 www-data 4u IPv6 46970 0t0 TCP *:http (LISTEN)
apache2 3106 www-data 4u IPv6 46970 0t0 TCP *:http (LISTEN)
apache2 3107 www-data 4u IPv6 46970 0t0 TCP *:http (LISTEN)
apache2 3108 www-data 4u IPv6 46970 0t0 TCP *:http (LISTEN)
apache2 3115 www-data 4u IPv6 46970 0t0 TCP *:http (LISTEN)
apache2 3116 www-data 4u IPv6 46970 0t0 TCP *:http (LISTEN)
apache2 3117 www-data 4u IPv6 46970 0t0 TCP *:http (LISTEN)
I also tried the command: sudo netstat -nltp | grep -iw "80" and the following is its output:
tcp6 0 0 :::80 :::* LISTEN 3102/apache2
To free port 80 I tried: sudo kill -9 3102, afterwards I ran: sudo netstat -nltp | grep -iw "80" and the output was: tcp6 0 0 :::80 :::* LISTEN 3330/apache2
(the port is re-occupied).
I very much like to know how I can use port 80 to develop my Laravel app on it (I am using Debian 9 Stretch).
Let me guess. I think you are running artisan server in the server. It's not recommended to run it on your production server. artisan server should only used for development environment.
Based on your explanation, port 80 has been used by apache2 server. That's normal. What you need to do is to put your Laravel application to apache DocumentRoot directory. Because apache2 is the real web server. For Debian like distribution, DocumentRoot for apache2 located at /var/www. You may follow this guide for more information.
Hope it helps.

MAC Intellij Idea can not run Web Project On port 80

I have a Web application project with J2EE , and I want to run my web application on port 80 with apache tomcat, i give this error :
4:31:34 PM Error running Test: Address localhost:80 is already in use
4:31:37 PM Error running Test: Unable to open debugger port : java.net.SocketException "Socket closed"
i use this command to show all process
Meysams-MacBook-Pro:~ meysamfatheepanah$ lsof -Pn -i4
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
UserEvent 309 meysamfatheepanah 4u IPv4 0x680181e2905eeb01 0t0 UDP *:*
SystemUIS 341 meysamfatheepanah 9u IPv4 0x680181e2905ed559 0t0 UDP *:*
SystemUIS 341 meysamfatheepanah 10u IPv4 0x680181e2905f00a9 0t0 UDP *:*
SystemUIS 341 meysamfatheepanah 13u IPv4 0x680181e2905ed2f1 0t0 UDP *:57792
SystemUIS 341 meysamfatheepanah 15u IPv4 0x680181e2905ed089 0t0 UDP *:*
sharingd 366 meysamfatheepanah 24u IPv4 0x680181e2905edc91 0t0 UDP *:*
sharingd 366 meysamfatheepanah 28u IPv4 0x680181e28eeb3fd1 0t0 UDP *:*
WiFiAgent 444 meysamfatheepanah 7u IPv4 0x680181e2905ec219 0t0 UDP *:*
Telegram 584 meysamfatheepanah 23u IPv4 0x680181e29016bba1 0t0 TCP 192.168.1.61:49367->91.108.4.170:443 (ESTABLISHED)
idea 1236 meysamfatheepanah 21u IPv4 0x680181e2944c39b1 0t0 TCP 127.0.0.1:51541 (LISTEN)
idea 1236 meysamfatheepanah 35u IPv4 0x680181e29f19aba1 0t0 TCP 127.0.0.1:51541->127.0.0.1:51670 (ESTABLISHED)
idea 1236 meysamfatheepanah 95u IPv4 0x680181e292c33ba1 0t0 TCP 127.0.0.1:6942 (LISTEN)
idea 1236 meysamfatheepanah 164u IPv4 0x680181e2905ec6e9 0t0 UDP 192.168.1.61:53244
idea 1236 meysamfatheepanah 165u IPv4 0x680181e2905f0a49 0t0 UDP *:9876
idea 1236 meysamfatheepanah 624u IPv4 0x680181e2939c30b9 0t0 TCP 127.0.0.1:63342 (LISTEN)
idea 1236 meysamfatheepanah 625u IPv4 0x680181e2936275d1 0t0 TCP *:2864 (LISTEN)
idea 1236 meysamfatheepanah 626u IPv4 0x680181e2905bb709 0t0 UDP *:2863
idea 1236 meysamfatheepanah 770u IPv4 0x680181e29361b9b1 0t0 TCP 192.168.1.61:51539->208.68.163.218:5222 (ESTABLISHED)
java 1329 meysamfatheepanah 123u IPv4 0x680181e293619ec9 0t0 TCP 127.0.0.1:51670->127.0.0.1:51541 (ESTABLISHED)
firefox 1331 meysamfatheepanah 37u IPv4 0x680181e29325b7c1 0t0 TCP 192.168.1.61:51739->172.217.18.226:443 (ESTABLISHED)
firefox 1331 meysamfatheepanah 41u IPv4 0x680181e2944862a9 0t0 TCP 192.168.1.61:51692->198.252.206.25:443 (ESTABLISHED)
firefox 1331 meysamfatheepanah 42u IPv4 0x680181e29325dba1 0t0 TCP 192.168.1.61:51736->74.125.206.94:443 (ESTABLISHED)
firefox 1331 meysamfatheepanah 43u IPv4 0x680181e2929fc2a9 0t0 TCP 192.168.1.61:51804->50.31.164.173:443 (ESTABLISHED)
firefox 1331 meysamfatheepanah 44u IPv4 0x680181e2939c42a9 0t0 TCP 192.168.1.61:51737->216.58.208.238:443 (ESTABLISHED)
firefox 1331 meysamfatheepanah 50u IPv4 0x680181e29f06d9b1 0t0 TCP 192.168.1.61:51733->172.217.19.131:443 (ESTABLISHED)
firefox 1331 meysamfatheepanah 54u IPv4 0x680181e2929f9ec9 0t0 TCP 192.168.1.61:51682->216.58.208.238:443 (ESTABLISHED)
firefox 1331 meysamfatheepanah 59u IPv4 0x680181e294498ba1 0t0 TCP 192.168.1.61:51738->216.58.208.238:443 (ESTABLISHED)
firefox 1331 meysamfatheepanah 61u IPv4 0x680181e29362a2a9 0t0 TCP 192.168.1.61:51686->216.58.211.100:443 (ESTABLISHED)
firefox 1331 meysamfatheepanah 71u IPv4 0x680181e29448a9b1 0t0 TCP 192.168.1.61:51673->104.16.112.18:443 (ESTABLISHED)
firefox 1331 meysamfatheepanah 74u IPv4 0x680181e29f0a75d1 0t0 TCP 192.168.1.61:51791->64.233.167.95:443 (ESTABLISHED)
firefox 1331 meysamfatheepanah 75u IPv4 0x680181e2944d79b1 0t0 TCP 192.168.1.61:51753->198.252.206.25:443 (ESTABLISHED)
firefox 1331 meysamfatheepanah 79u IPv4 0x680181e2929fb0b9 0t0 TCP 192.168.1.61:51798->216.58.208.200:443 (ESTABLISHED)
firefox 1331 meysamfatheepanah 82u IPv4 0x680181e2929fcba1 0t0 TCP 192.168.1.61:51799->23.235.43.175:443 (ESTABLISHED)
firefox 1331 meysamfatheepanah 87u IPv4 0x680181e294482ba1 0t0 TCP 192.168.1.61:51800->50.31.164.172:443 (ESTABLISHED)
firefox 1331 meysamfatheepanah 88u IPv4 0x680181e2932997c1 0t0 TCP 192.168.1.61:51774->216.58.208.227:443 (ESTABLISHED)
firefox 1331 meysamfatheepanah 92u IPv4 0x680181e29f13c7c1 0t0 TCP 192.168.1.61:51767->198.252.206.25:443 (ESTABLISHED)
firefox 1331 meysamfatheepanah 93u IPv4 0x680181e292c305d1 0t0 TCP 192.168.1.61:51802->23.51.123.27:80 (ESTABLISHED)
firefox 1331 meysamfatheepanah 95u IPv4 0x680181e2944c30b9 0t0 TCP 192.168.1.61:51785->23.51.123.27:80 (ESTABLISHED)
firefox 1331 meysamfatheepanah 101u IPv4 0x680181e296a4f7c1 0t0 TCP 192.168.1.61:51768->172.217.20.42:443 (ESTABLISHED)
and for this command i give this output
Meysams-MacBook-Pro:~ meysamfatheepanah$ sudo lsof -nP -iTCP -sTCP:LISTEN
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
idea 1236 meysamfatheepanah 21u IPv4 0x680181e2944c39b1 0t0 TCP 127.0.0.1:51541 (LISTEN)
idea 1236 meysamfatheepanah 95u IPv4 0x680181e292c33ba1 0t0 TCP 127.0.0.1:6942 (LISTEN)
idea 1236 meysamfatheepanah 624u IPv4 0x680181e2939c30b9 0t0 TCP 127.0.0.1:63342 (LISTEN)
idea 1236 meysamfatheepanah 625u IPv4 0x680181e2936275d1 0t0 TCP *:2864 (LISTEN)
Meysams-MacBook-Pro:~ meysamfatheepanah$ netstat -atp tcp | grep -i "listen"
tcp4 0 0 localhost.51541 *.* LISTEN
tcp4 0 0 *.astromed-main *.* LISTEN
tcp4 0 0 localhost.63342 *.* LISTEN
tcp4 0 0 localhost.6942 *.* LISTEN
i think another process from osx or etc use from port 80 .
have any idea about it?
try $ sudo lsof -Pn -i | grep ":80 (LISTEN)"
I expect you'll get something like
httpd 6477 root 5u IPv6 0x261be06accde8493 0t0 TCP *:80 (LISTEN)
httpd 6484 _www 5u IPv6 0x261be06accde8493 0t0 TCP *:80 (LISTEN)
which means: your mac web service is running.
If you're on Mountain Lion or newer, I also expect you had it once enabled in older OS versions via sharing dialog. Unfortunatly Apple removed this setting but didn't disabled the service ... that's how it looks to me. Perhaps it has been reset via timeMachine restore in background too
temporary unload: sudo apachectl stop
permanent unload: sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist

Find which process is listening on port 8001 on Mac OS X

How can I see which process is listening on port 8001 on Mac OS X?
I have tried several commands:
lsof -i | grep LISTEN
Output:
qbittorre 321 user 26u IPv4 0xc8e6037f28270c31 0t0 TCP *:6881 (LISTEN)
qbittorre 321 user 27u IPv6 0xc8e6037f216348e1 0t0 TCP *:6881 (LISTEN)
mysqld 14131 user 10u IPv4 0xc8e6037f3218da91 0t0 TCP *:mysql (LISTEN)
httpd 14133 user 16u IPv6 0xc8e6037f216352e1 0t0 TCP *:http (LISTEN)
httpd 14135 user 16u IPv6 0xc8e6037f216352e1 0t0 TCP *:http (LISTEN)
httpd 14136 user 16u IPv6 0xc8e6037f216352e1 0t0 TCP *:http (LISTEN)
httpd 14137 user 16u IPv6 0xc8e6037f216352e1 0t0 TCP *:http (LISTEN)
httpd 14138 user 16u IPv6 0xc8e6037f216352e1 0t0 TCP *:http (LISTEN)
httpd 14139 user 16u IPv6 0xc8e6037f216352e1 0t0 TCP *:http (LISTEN)
httpd 14148 user 16u IPv6 0xc8e6037f216352e1 0t0 TCP *:http (LISTEN)
httpd 14149 user 16u IPv6 0xc8e6037f216352e1 0t0 TCP *:http (LISTEN)
httpd 14150 user 16u IPv6 0xc8e6037f216352e1 0t0 TCP *:http (LISTEN)
Skype 14543 user 57u IPv4 0xc8e6037f324f9a91 0t0 TCP *:18666 (LISTEN)
java 24640 user 68u IPv6 0xc8e6037f3295a3e1 0t0 TCP *:http-alt (LISTEN)
java 24640 user 73u IPv6 0xc8e6037f32958fe1 0t0 TCP *:8009 (LISTEN)
java 24640 user 101u IPv6 0xc8e6037f32959ee1 0t0 TCP localhost:8005 (LISTEN)
lsof:
sudo lsof -nPi -sTCP:LISTEN | grep 8001
Nothing found
netstat:
netstat -a | grep 8001
Nothing found
I know that the port is in use by someone, because I am trying to change the Emacs simple-httpd default httpd-port from 8080 (default) to 8001, and it fails:
Warning (initialization): An error occurred while loading `/Users/user/.emacs':
File error: Cannot bind server socket, address already in use
To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file. Start Emacs with
the `--debug-init' option to view a complete error backtrace.
How can I resolve it? I tried also to set the port to 8002, with the same problem and didn't find which process is listening on port 8002.
What can be the source of the problem?
Using nmap I discovered that port 8001 is used by vcom-tunnel service and it’s a closed port and that port 8002 is used by teradataordbms and is also closed.
What are these services used for? Can I disable them and use their occupied ports?
You can use lsof to detect who is using the connection as long as there is active traffic on the connection.
Here is a demonstration:
setting a server on a given port fails with the error Address already in use
lsof doesn't report any listener for that port
Here is the shell log demonstrating this:
python -m SimpleHTTPServer 3333 2>&1 | fgrep error
Output:
socket.error: [Errno 48] Address already in use
sudo lsof -i TCP:3333
echo $?
Output:
1
[1] : starting a web server on port 3333 fails with the error Address already in use
[2] : lsof doesn't report port 3333 being used by anyone
Let's generate traffic in order to force lsof to detect the usage of the port: in another terminal open a telnet connection:
telnet localhost 3333
Now back on your previous terminal, you will see that lsof finds your port:
sudo lsof -n -P -i :3333
Output:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
telnet 78142 loic 5u IPv4 0x3fa2e8474ece6129 0t0 TCP 127.0.0.1:51855->127.0.0.1:3333 (ESTABLISHED)
There is traffic going on, but according to the OS, only one end of the connection is there, the initiator, there still isn’t any `LISTENER`!
Note: in my case, OS is macOS v10.13.3 (High Sierra), but I had that with previous versions of macOS/OSX too

Cannot connect to apache server locally

I am trying to access an Apache server on my local machine, but can't get it to work. I had it working last week, but then it randomly stopped working. I have edited the httpd.conf file to update the port to 9876. I also added the ExecCGI directive in the HTDocs directory.
I usually see the index.html page I created by visiting localhost:9876, but now I just see an erroneous page. When I just run localhost:80, I see the it works page! How is something still showing up on port 80 when I clearly changed it to another port? I read more about this and found out it has to do with the sharing settings on OSX. These settings were never enabled to begin with. Why am I still seeing a page on port 80, and why is the designated port I chose not showing any content?
Things I have done:
I have tried stopping and restarting the server multiple times(with
sudo)
I use the web browser or netcat to connect to apache, but I get no response.
I ran lsof -i4TCP:9876 and get the following output:
launchd 1 root 25u IPv6 0xee69429dde6f1b6f 0t0 TCP localhost:ipp (LISTEN)
launchd 1 root 26u IPv4 0xee69429dde6f2b77 0t0 TCP localhost:ipp (LISTEN)
LogMeIn 82 root 5u IPv4 0xee69429dde6f238f 0t0 TCP *:globe (LISTEN)
vpnagentd 83 root 6u IPv4 0xee69429de115bb77 0t0 TCP localhost:29754 (LISTEN)
GitHub 201 kamranpirwani 6u IPv4 0xee69429de35f4b77 0t0 TCP localhost:25035 (LISTEN)
GitHub 201 kamranpirwani 7u IPv6 0xee69429dde6f0eaf 0t0 TCP localhost:25035 (LISTEN)
mysqld 412 _mysql 14u IPv6 0xee69429dde6efdaf 0t0 TCP *:mysql (LISTEN)
Coda\x202 726 kamranpirwani 5u IPv4 0xee69429deb25fb77 0t0 TCP *:6942 (LISTEN)
Coda\x202 726 kamranpirwani 7u IPv6 0xee69429dde6f12ef 0t0 TCP *:6942 (LISTEN)
Coda\x202 726 kamranpirwani 10u IPv4 0xee69429deb47438f 0t0 TCP *:50490 (LISTEN)
Coda\x202 726 kamranpirwani 11u IPv6 0xee69429dde6f062f 0t0 TCP *:50490 (LISTEN)
Coda\x202 726 kamranpirwani 12u IPv4 0xee69429dea898b77 0t0 TCP *:50491 (LISTEN)
Coda\x202 726 kamranpirwani 13u IPv6 0xee69429dde6ef96f 0t0 TCP *:50491 (LISTEN)
httpd 1879 root 5u IPv6 0xee69429dde6f172f 0t0 TCP *:http (LISTEN)
httpd 1880 _www 5u IPv6 0xee69429dde6f172f 0t0 TCP *:http (LISTEN)
httpd 1920 _www 5u IPv6 0xee69429dde6f172f 0t0 TCP *:http (LISTEN)
This leads me to believe the my apache web server is listening for requests on this port. Why can't the browser or netcat connect to it?
Edit:
Log file(with personal email removed) http://pastebin.com/84RcB2Er
First you say (emphasis mine):
I am trying to access an Apache server on my local machine, but
can't get it to work.
But then you say (again, emphasis mine):
When I just run on localhost, I see the it works page!
So unclear what the problem is.When you say you edited the .conf which one? Apache by default can handle virtual hosts so it’s possible you are running two virtual hosts on your machine with different document roots: One responding on port 80 & the other on port 9876. Can you exact details of the contents of the file you changed?
EDIT: The original poster indicates they are editing the httpd.conf in this location:
~/apache/conf/httpd.conf
When the systemwide Apache config is in this location:
/etc/apache2/httpd.conf

Resources