Linux Xdebug (again) - linux

Environment:
Windows 10 > Linux (Ubuntu Server) via LAN
PhpStorm
Followed https://xdebug.org/wizard.php
and https://www.jetbrains.com/help/phpstorm/zero-configuration-debugging.html
php.ini (/etc/php/7.2/fpm/php.ini as using Nginx) has:
zend_extension = /usr/lib/php/20170718/xdebug.so
xdebug.remote_enable = On
xdebug.remote.connect_back = 1
;xdebug.remote_host=192.168.56.1;commented out as copied from another PC with VBox (x-debug working here) but left for reference
xdebug.remote_port=24680;port 9000 is usually occupied by FPM, so port change recommended
xdebug.remote_autostart=1
xdebug.idekey=PHPSTORM
xdebug.remote_log="/tmp/xdebug.log"
* EDIT- using xdebug.remote_host=192.168.0.201 works but I want to use multiple network locations to debug from preferablly also WAN *
I have setup bookmarklets as per PhpStorm link and clicked the bookmarklet:
javascript:(/** #version 0.5.2 */function() {document.cookie='XDEBUG_SESSION='+'PHPSTORM'+';path=/;';})()
In the actual IDE the View>debug window is greyed out but allow incoming connections all green. The Language>PHP>Debug is set to stop at first line and has same port number 24680.
In setups on other systems I have at least had flagged up that mappings need attention but I simply cannot get to any debug view here.
tail -f /tmp/xdebug.log
gives:
Log opened at 2018-08-24 21:52:05
I: Connecting to configured address/port: localhost:24680.
W: Creating socket for 'localhost:24680', poll success, but error: Operation now in progress (29).
W: Creating socket for 'localhost:24680', poll success, but error: Operation now in progress (29).
E: Could not connect to client. :-(
Log closed at 2018-08-24 21:52:05
Showing response.
Obviously something missed with connecting back to Windows client PhpStorm.
Tested with Windows firewall off
I will also need to connect remotely via port forwarding to this server at some point, however all this initial setup is on LAN.
When I mention setups regarding other systems they are physically seperate (IE Macbook talking to its own VBox). This setup is a windows machine talking to a real Linux server on the same LAN. SSH is not used here.
php.ini is (/etc/php/7.2/fpm/php.ini as using Nginx)
Anyone got any idea ?

Related

how to launch jhs on remote linux server and get access to it from remote client like chromebook

I'm trying to figure out how to get access to J from remote client because I'm using chromebook. That would require me to put in the address bar of my web browser "123.45.67.89:65001/jijx" instead of "http://localhost:65001/jijx." I installed j on remote linux server. And I typed like following through terminal shell and ended up in fail with abrupt closing of J session. What's wrong with me?
load '~addons/ide/jhs/core.ijs'
init_jhs_''
J HTTP Server - init OK
Ctrl+c here signals an interrupt to J.
Browse to: http://127.0.0.1:65001/jijx
myname#mine:~$ Running Firefox as root in a regular user's session is not supported. ($HOME is /home/myname which is owned by myname.)
You should directly load a configuration:
load'~addons/ide/jhs/config/jhs.cfg' NB. default configuration
You should allow for the remote IP in the configuration. For example, add the following line to jhs.cfg:
BIND =: 'any'
Recent JHS releases no longer require the BIND config parameter.
In your localhost JHS session, click help menu, then wiki JHS, and then Server to get the info you need.

IIS Manager Error - Unable to bind to the underlying transport for [::]:80.The process cannot access the file because

I know that this question has been asked in multiple forums and have several versions of the answers.. Unfortunately, none of those answers helped me out to resolve my issue.
I stood up an AWS EC2 instance of Windows Server 2016 and installed IIS, MSMQ, Windows Process Activation Service and few other things.. When I cracked open my IIS Manager, I noticed that the "Default Web Site" is stopped and when I tried to start it I get an error "The process cannot access the file because it is being used by another process (Exception from HRESULT:0x80070020)". Tried to dig a little more and found these two exceptions in my Event Viewer:
Unable to bind to the underlying transport for [::]:80. The IP Listen-Only list may contain a reference to an interface which may not exist on this machine. The data field contains the error number.
The World Wide Web Publishing Service (WWW Service) did not register the URL prefix http://:80/SmsHandler for site 1. The site has been disabled. The data field contains the error number.*
Researching more online I found more than 2 dozen articles on this issue and more than 95% of them saying that the potential application that might be conflicting with IIS and using port 80 and 443 could be Skype.. But I DON'T HAVE SKYPE installed on my server..
I ran the "netstat -aon" command and found this:
C:\Windows\system32>netstat -aon | findstr :80
TCP 169.254.170.2:80 0.0.0.0:0 LISTENING 1164
Going by what's mentioned in other articles online.. I tried to trace down the PID - 1164 in my Task Manager and found that its the "Service Host - Local System" process having 15 System services running into it.. There's no way I can kill that process to make my IIS work..
I then tried to change the Bindings in my IIS to listen on a different port than 80 and was able to get it up and running.. But I don't want IIS to run on any other port than 80 since I don't want the user to specify the port in the URL every time when they hit the website..
I'm now running short of ideas here.. Any suggestions would be greatly appreciated.
Thanks!
I ran into a similar issue, but not with port 80. In my case it was because the ip address [::] wasn't allowed to listen on any port. Adding it to the ListenOnly list in the registry fixed the issue.
From an admin command prompt:
netsh http add iplisten ipaddress=::
From this thread.
Found the culprit.. It apparently wasn't skype for me (as it is in most of the cases), it was this service called IP Helper which was running on port 80 and was conflicting with IIS. The way I found that out was, I checked all the services running under the PID for Service Host - Local System (which in my case as 1164) and started stopping them one at a time and saw if IIS starts working.. Just wanted to close this thread.. Hope this helps if someone else get stuck with the same issue.
I had VMware Workstation installed, the solution is: "VMware -> Edit -> Preferences -> Shared VMs -> "Disable Sharing".

X-win launching the same application on a second client, the first client gets called

I'm currently connected to my local server (LAN) via SSH and have opened Firefox. I'm using it to access a service running on said server but limited to the 127.0.0.1 space.
When I connect to a second server (WAN) again via SSH and open Firefox from there (I'm using the Cygwin/X server) the page I open is called by the first instance of Firefox (in a new tab). I'm calling the remote server's router at 192.168.1.1 but see my local router's page instead!
If I then close the original instance of Firefox, I get the remote server's router page as expected.
I hope this is clear and can provide extra info if needed.
What I'm expecting is to have two Firefox windows on my desktop, each one running on it's own server.
Thanks

Multicast DNS problems

Feeling a bit lost after many days of relentless digging and looking for inspiration...
The story so far:-
I have a Microchip PIC32-based wifi-dev board running TCP/IP stack v5.36.
After boot-up, the app works fine when requesting the default 'mchp.local' domain name in the browser. The web browser receives updates correctly every second from the embedded web server on the PIC.
After an indeterminate time however (usually about 1 hour or so), the 'mchp.local' page times out and the browser reports
'ERR_NAME_NOT_RESOLVED: The server at mchp.local cannot be found. because the DNS lookup failed.'
And yet, I can access the app on its corresponding IP address (in this case 172.16.15.103) and I see the app is running fine.
I also see infinite loop in the the main() routine is running as expected and the web server is responding to changes when I request pages using just the IP address.
I have tested using Chrome on Windows and Mac machines - same issue.
I have tried using Packet Peeper (a free network packet analyser for Mac OS X) to filter out all messages NOT on UDP port 5353 (as per RFC 6762) and I see nothing useful.
I have trace-debugged the code and found that the mDNS state machine is in DEFEND mode, both before and after the moment when the app stops responding with DNS "ERR_NAME_NOT_RESOLVED".
I suspect the problem lies in the multicast DNS module but my findings so far do not help me to piin point the root cause.
Any clues? Where should I look next?
My environment:
Mac OS X 10.9.5 (Mavericks)
Browser: Chrome v.44
Embedded Kit uC: Microchip PIC32MX695F512H
Embedded Kit WiFi interface: Microchip MRF24WB0MA
Dev Tools: PICKit3, MPLAB X IDE v2.25, Packet Peeper 2014-06-15

CentOS server: how to detect network status changes

I have setup a CentOS 6.4 server (minimal install) which is connected to network through an ethernet cable. The problem is that when the network link goes down, the status changes are not automatically detected but if i type "ifconfig" the interface still keeps its IP address (which is assigned by a DHCP server). After some time that the link is down the interface loses the address but when the link comes up again the network connection is not automatically restored like it would happen in a desktop computer. Even the command "dhclient eth0" does not always work to restore things, and I have to restart the whole network service with "/ect/init.d/network restart".
Is there any way to automatically detect network status changes like it happens in desktop installations? I'm thinking about a cron script that every 5 minutes pings a server outside my network and if it doesn't get any response it restarts network service, but this does not sound very efficient... is there another way?
EDIT: I realized I have not explained the situation correctly. My network topology is: server --> switch --> router --> external network (the router is another centos server with DHCPD).
For some reasons (that i'm not getting), when it happens that the router goes down and reboots, the other server becomes unreachable, and I have to manually restart network service on it. So the link does not effectively go down (the switch keeps it up), but the status change is at IP level.
You can check if you have NetworkManager enabled, I usually don't use it in the servers but it can help you in this case because it will monitor automatically the connections (it is quite common in desktop installations).
https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/ch-NetworkManager.html
To look for messages indicating an issue with the NIC just check the kernel ring buffer using the dmesg command.
For example when the cable is disconnected from a given interface this is what I get:
igb: eth1 NIC Link is Down
The first word will depend on the name of your network driver.
You could also configure the system to log these messages also to /var/log/messages (by default I am not sure if they appear there). Then it would be just a matter of monitoring the log, look for similar messages and restart the network service.
In any case the NetworkManager, if it is not already enabled, it should be an easier solution.
There is a module called miimon for monitoring the network interface's status. ethtool will give you the link status.
$ethtool eth0
...
Link detected: yes

Resources