Using XDebug and PhpStorm from guest VM, via host browser - ssh

I have a bit of a peculiar setup: On a Windows 10 host, I have an Ubuntu VirtualBox guest running. I use an SSH terminal with X11 forwarding to launch PhpStorm directly from the guest and display it on my host. My web server is also on the VM, and I access it from my host machine's browsers with a virtual host such as, say, http://local.dev.
This setup works rather nicely, allowing me to skip copying my server files to the host to edit them with a host-based PhpStorm. However, I have difficulties properly getting XDebug to run on the host machine's browser.
The only way I've managed to debug things is by adding ?XDEBUG_SESSION_START at the end of URLs I launch from my host browser, however this only works for breakpoints in immediately executed code, rather than AJAX calls, as I get the following PhpStorm message after the page is loaded:
16:53:02 Debug session was finished without being paused
It may be caused by path mappings misconfiguration or not synchronized local and remote projects.
How to set up XDebug on the VM to allow debugging from the host browser? I've tried mapping paths, however it seems to make no sense, as for PhpStorm and XDebug the files aren't on a remote host.

Related

Apache - CentOS 8 - Can't view hosted webpage except from the local server

The Issue: I have disabled SELinux entirely. We have Apache running on a CentOS 8 VM. We have a simple information page running on the server. It displays great when we are on that VM in Gnome using either 127.0.0.1, locahost, or it's actual IP address. However, we cannot view this page from the same subnet or any subnet. The message we get in our browsers when off that server is "server took too long to respond". I am thinking there is some small little thing we must be missing in the Apache config. We even have Webmin on there to make the administration easier. I have never had this problem with CentOS 5/6/7 previously. I know that CentOS 8 is the last release as RHEL has bought it, and they want to see CentOS killed off.
Actions Taken:
Disabled SE Linux entirely to eliminate it being a firewall issue.
Installed Webmin to have access to the Apache administration module making looking for any issue easier.
Tested from the server itself in Gnome which the page comes up.
Tested from other computers on the same subnet, off the same switch.
Tested from other subnet computers.

X11 forwarding: `xclock` works but not `cmake-gui`

I am connecting (ssh) to my host (Mac) from my client (Windows) machine. I have X11 forwarding active.
Now, running xclock on my host opens up the clock gui window on my client as expected, but running cmake-gui does not. I can see the application gui open up on my host (through teamviewer), but it isn't shown on my client.
I was able to make it work with WSL but somehow it's not working for my iMac as host.
I can provide more details if needed. Let me know how.

Hugo webserver not reaching my Windows vm

I want to test my website on edge and internet explorer so I tried using a windows VM, I am currently on linux mint 19.1, I start the gohugo server with "hugo server --disableFastRender" and create the VM in virtualbox using bridged adapter but I cant load localhost:1313 on the vm.
I tried using NAT and port forwarding but I have the same results, also tried the conection between the host and VM using ping and the VM can reach the host but the host cant connect to the VM so I guess that the problem is there but I dont know what to do now. The place where I am working uses IPv6 and I never worked with it before so maybe it has something to do with that
Start your site as usual with hugo server, which makes it available at http://localhost:1313
Leave your Windows VM network settings at their defaults
In your Windows VM, navigate to http://10.0.2.2:1313 to hit your hugo site
In a nutshell, 10.0.2.2 on your Windows VM (its default gateway) is equivalent to localhost on your linux host.
You can get the default gateway of your Windows VM by running ipconfig in Command Prompt.

How can I run Selenium tests when my site is in Vagrant?

I use Vagrant for my local development. Now I want to use Selenium for automated browser testing. When I setup Selenium in my VM, it works like a charm (great stuff by the way).
But now I want to move the Selenium testing out of the box. I tried to run the Java server on my host machine, forward port 4444 to port 4444 in virtualbox, and then fire the phpunit-command in VirtualBox, hoping to trigger the server on my host machine.
But instead I get a CURL-message that phpunit can't connect to 127.0.0.1:4444, so obviously there is no connection to my host machine on this port.
Can anyone tell me what I'm doing wrong?
Edit: I figured out that when I'm running the server on the host, I cannot access 127.0.0.1:4444 in my browser, however, I am able to access localhost:4444. Which is weird, because my hosts-file has the correct line (although it shouldn't matter since phpunit is trying to access a numeric address).
I think the best solution for this is to setup a "private network" this way you'll be able to use internal address to access your vm and host separately...
Depending of your vm provider different solution are possible (for example, Virtualbox support internal netowrk only)
Have a look at : http://docs.vagrantup.com/v2/networking/private_network.html

Apache Tomcat not working in every web browser installed in Windows7 32Bit

I'm working on a web application in JSP and my web container is Apache Tomcat 7.0.2 (Its portable cross-platform version). As I've made extensive use of HTML5-CSS3 and my target browser is Google Chrome, I'm able to run the the Apache server only in Opera web browser, neither of the remaining installed browser run it.
Here's the steps I have followed to start the server in my Windows 7 machine.
-Installed the Apache Tomcat service in Windows from apache-tomcat-7.0.2/bin/service.bat
-Started the service with tomcat7w.exe
-As my default port is 8080, I open 'http://localhost:8080/' in various web browsers, and I could see Apache Server Homepage with same address only in Opera Web Browser (11.01), neither of other browsers installed can open it (Chrome 9, Firefox 4 Beta 11 or IE8) and show standard page not found message.
-I also tried other port numbers, but none of them worked.
What can I do to make Apache run in every browser installed in my computer?
I have my computer dual boot with Windows 7 and Ubuntu 10.10, and in Ubuntu, every web browser installed can run Apache once I start it, but same is not working in Windows.
Update:
I have also tried apache's windows-only installer of version 7.0.8 and changed the port number during installation, but still I can't run it on any other browser expect for Opera...
Any help will be appreciated............
Thanks.
Check your hosts file under C:\Windows\system32\drivers\etc\hosts to make sure that the entry for
127.0.0.1 localhost
is intact. Also see that if you are behind a proxy server, the settings allow for localhost to be bypassed.
Congo!! finally got it done, instead of localhost, it works with 127.0.0.1 (which is localhost anyway)
So those who are facing similar issues, as suggested by adarshr, go through your hosts file to see if localhost is correctly addressed to 127.0.0.1, or if you don't want to edit that file, you can still get it done by simply using http://127.0.0.1:8080/ instead of http://localhost:8080/. Please be sure about port number you are using, in my case it was 8080, it might vary depending on how you've configured.