More Research on Moving XAMPP's Apache port

Problems with the Windows version of XAMPP, questions, comments, and anything related.

More Research on Moving XAMPP's Apache port

Postby johnswolter » 12. May 2012 00:12

A bit more searching found two articles on using your computer as a development platform for Apache and Nginx.

by mike plate at mikeplate.com
http://www.mikeplate.com/2011/11/06/stop-http-sys-from-listening-on-port-80-in-windows/

His article does a good job of describing what http.sys is and how Win 7 uses this protocol stack. Applications subscribe to this stack, defining what it wants and then is alerted to incoming headers. His idea to get around this is to use netsh to bind http.sys to IPv6 to free IPv4's port 80. http://localhost then goes to http.sys on IPv6. Then he runs a Nginx server on IPv4's port 80

He also suggests editing the C:\Windows\System32\drivers\etc\hosts file adding "127.0.0.1 local". "local" now goes to the IPv4 address 127.0.0.1. Type "local' and you are connected to the IPv4 127.0.0.1. This would be the Apache server in XAMPP.

This whole sequence suggests to me as to whether netsh could be used to create another 127.0.0.x address or another IP interface on the NIC card to assign the entire XAMPP programs to use. How will this work when your working with a wireless connection?

Second link at the end of Mike Plate's article is an article from the Montreal SEO Company, "Configuring nginx with PHP on windows"

http://www.montrealseocompany.com/2012/05/04/configuring-nginx-with-php-on-windows/

Their article is focused on Nginx and PHP but you can substitute Apache for Nginx. They use the a different TCP port number by modifying the configuration files to handle this issue. This includes changes to PHP start command and markup code. They also suggest using using Telnet as a simple debug tool.

Okay looking at Mike Plate's solution to me looks better if Windows applications accessing "localhost" all use that name to get to the local Win 7 http.sys listener. If there are Win 7 applications coded to use 127.0.0.1 literal then there could be some undocumented anomalies. The choice would then be to change to another TCP port number.

Mike Plate's solutions would require XAMPP Windows installer version to add steps to offer to change ports, add interfaces, modify the hosts file, and modify the start batch files. Maybe it is a good idea to check port usage for all the packages and offer to change the configuration.

Considering that Microsoft first introduced the http.sys subscription listener service in Win Server 2003, I have to speculate that an Apache project or some other open source project has already solved this problem. That's the next search.

Cheers,
JSW
johnswolter
 
Posts: 7
Joined: 09. July 2011 19:07

Re: Problem accessing port 80, Apache won't start

Postby johnswolter » 12. May 2012 02:48

Running Apache on localhost:8080 (localhost port 8080) has some issues. When you press the [Admin] button you get a blank page. I think the default Windows 7 http.sys "routed" or the application that subscribed and displays the default page. So you manually, sorry, type http://localhost:8080/ into your favorite browser tab's address box.

Then you will see the XAMPP welcome page but look now at the address box. You will see http://localhost:8080/xampp/ . The ending / is a polite thing which speeds resolution of the name.

You will need to use this welcome screen to use the other administration packages or pages. The [Back] button does not seem to always work when you inside one of the administration pages. Usually the Welcome navigation choice on the left side will take you back to the Welcome page. If not you can always type the starting localhost... back into the address box.

If your using tomcat it uses port 8080, soooooo...your going to have to choose a different port. The file XAMPP.INI in the src/xampp-control-panel folder has definitions of which ports are used for http, mysql, and tomcat.

Now to get around this typing in the address box there is an Apache add-on named mod_rewrite. It can be set to translate localhost to maybe localhost:8080 or maybe for 8081. This will be my next test.

All this just to develop a Wordpress site.

Cheers, JSW
johnswolter
 
Posts: 7
Joined: 09. July 2011 19:07

Re: Problem accessing port 80, Apache won't start [Solved]

Postby JonB » 12. May 2012 15:10

I think its great you are writing all this - but - It probably belongs in its own topic, not tacked on to a resolved issue.

On the other hand, http.sys is a DEVICE (albeit a soft one). Its used by many different Microsoft products as a driver. (That's why the name ends in .sys) So it might be IIS if you find Web Publishing Service in Services, but it can also be any of many Web Management interfaces for MS products. THOSE are almost always Services (a special class of executable). IIS is a service, as is Apache. Anything you turn 'Remote Web Management' on for that comes from Redmond likely will use http.sys.

Rather than hacking up a XAMPP install, I usually recommend some detective work with tools like Process Explorer.

This isn't some official XAMPP pronouncement - rather my own observations, based on a lot of experience. Never-the-less, thank you for you efforts.

8)
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: Problem accessing port 80, Apache won't start

Postby Altrea » 12. May 2012 15:27

Hi JSW,

johnswolter wrote:Now to get around this typing in the address box there is an Apache add-on named mod_rewrite. It can be set to translate localhost to maybe localhost:8080 or maybe for 8081.

This is not really correct, maybe just not explained detailed enough.
localhost is just a DomainName, an alias for the loopback IP 127.0.0.1. URLs can handle this DomainName to send and receive requests.
The DomainName or IP within an URL must have an Port number, with the only exeption that the default port for HTTP communication (port 80) can be omitted.

mod_rewrite CAN rewrite URLs, but only from the requests which can already received by your Apache. So, rewriting localhost:80 can only be rewritten to localhost:8080 if your Apache already listening on port 80. If this rewrite makes really sense depends on the requirements and is commonly just helpful if you are using two webservers (maybe for different script languages).

best wishes,
Altrea
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 8286
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Re: More Research on Moving XAMPP's Apache port

Postby johnswolter » 12. May 2012 22:29

I'm wondering about the nature of http.sys. I was browsing iis.net where I noticed a technical comparison of Apache & IIS where there is a table of mod_ modules with near equivalent IIS functions/objects. It would be interesting to see if http.sys would attempt to bind to a newly created IP interface. A debugger or logging programs need to watch what http.sys is doing and with whom and why. Once that knowledge is acquired it can be used to figure how to FIX it good.

Interesting the characterization as a soft-device. You would think it would be possible to create a mod_http_sys service that would plug all of Apache into it. It would subscribe to http.sys like other services and translate to Apache's environment. Of course you'd want to write in gcc(+) to keep it in the family.

I also wonder about using mono-project.org to create the XAMPP-control-panel. I could also speculate about using Python for that as well. Either of those could also make the control panel more platform portable. I like the additions in the Beta Control Panel. The [Config] buttons appear hardwired for phpmyadmin to invoke "http://localhost/phpmyadmin. If you are using new ports then that string needs a way to be edited.

I was looking to see if there was an .ini file or a way to reconfigure the buttons as needed. I liked the Beta panel CLI shell, netstat, & win-services buttons. As I mentioned I wanted to be able to change the [Config] buttons as needed. The netstat display show http.sys clearly is running on port 80.

I was a little confused by the check-marked boxes for the 1st three packages. I checked & I don't think they were running as services, rather it appeared they ran as user space programs. You can see some of this using process-exploder.

The progress window displays the system events and log reports which is very helpful. A verbose mode per package would be useful. When I program logging I always turn it off when I log out of the program and when it is started. Checked boxes could override but how big is your hard drive?

Another service appearing everywhere is Google Drive. Like other online storage it is a work in progress. I've not determined the ports it is using yet. That goes to my InBox.

I use Skype, Teamviewer, tightVNC, and when forced RDP for remote administration. The current control-panel event list mentions Teamviewer as using 443. Off to fix that......

.....okay it's fixed. Got to Teamviewer's options dialog window. Pick the Advanced item at the bottom. The right panel has a button asking to show Advanced options(totally redundant). Scroll down that list to the Advanced Network Settings. Check the box, "Don't use incoming ports 80 and 443". The red colored event message should go away. If not oops. Look further.

As far as putting more knowledge into the installer, you can never keep up with a current enough distribution. I've thought about creating an online knowledge base to feed the installer while it does its work. This a sort of real-time installing updater. Just a thought.

I'll need to write a reply to Altrea as I noticed he as I had figured out rewrite works from Apache. Rewrite is not standalone.
johnswolter
 
Posts: 7
Joined: 09. July 2011 19:07

Re: More Research on Moving XAMPP's Apache port

Postby hackattack142 » 13. May 2012 05:12

I do not have much to say about the first part of your post and I am unsure why you are so focused on a kernel-level driver.

also wonder about using mono-project.org to create the XAMPP-control-panel. I could also speculate about using Python for that as well. Either of those could also make the control panel more platform portable. I like the additions in the Beta Control Panel. The [Config] buttons appear hardwired for phpmyadmin to invoke "http://localhost/phpmyadmin. If you are using new ports then that string needs a way to be edited.
First, I could cross compile it to Linux but a lot of the backend stuff right now is Windows specific. It would have to be largely recoded for it to be compatible with Linux which I have no plans of doing right now. Also, the ports are not hardcoded. If you change the ports from default inside of the control panel, the changes will be reflected in any URLs the control panel calls.

I was looking to see if there was an .ini file or a way to reconfigure the buttons as needed. I liked the Beta panel CLI shell, netstat, & win-services buttons. As I mentioned I wanted to be able to change the [Config] buttons as needed. The netstat display show http.sys clearly is running on port 80.
I did not give explicit control of each button because there is not a real need for it and it would add more complexity to the code. The netstat shows the process name using a port as reported by Windows. Even if I could get the specific system driver that does not really give you anything useful. The process level should be enough. There is not an easy way to determine if specific Windows Services are using a specific port that I have found.

I was a little confused by the check-marked boxes for the 1st three packages. I checked & I don't think they were running as services, rather it appeared they ran as user space programs. You can see some of this using process-exploder.
That has been changed. You are using an old beta. In the beta you are using, a grey check mean not using a service and a green check means the service is installed. It is more clear in later versions. viewtopic.php?f=16&t=48932

The progress window displays the system events and log reports which is very helpful. A verbose mode per package would be useful. When I program logging I always turn it off when I log out of the program and when it is started. Checked boxes could override but how big is your hard drive?
What?

If another program is blocking a port that a server needs to bind and listen on, you have two choices. Either disable/uninstall/reconfigure the blocking application or change the port the server is listening on for connections. I am not sure what you are getting at with the installer so I will not comment on that.
XAMPP Control Panel Developer
Latest CP: viewtopic.php?f=16&t=48932
hackattack142
 
Posts: 703
Joined: 20. May 2011 23:29
Operating System: Windows 7 Ultimate SP1 64-Bit

Re: More Research on Moving XAMPP's Apache port

Postby johnswolter » 13. May 2012 20:09

hackattack142 wrote:
I was a little confused by the check-marked boxes for the 1st three packages. I checked & I don't think they were running as services, rather it appeared they ran as user space programs. You can see some of this using process-exploder.


That has been changed. You are using an old beta. In the beta you are using, a grey check mean not using a service and a green check means the service is installed. It is more clear in later versions. http://community.apachefriends.org/f/viewtopic.php?f=16&t=48932


I'll upgrade that first, redo my configuration, and see how it all goes. Then I'll come back to see how my comments changed.

Cheers
-JSW
johnswolter
 
Posts: 7
Joined: 09. July 2011 19:07

Re: More Research on Moving XAMPP's Apache port

Postby johnswolter » 13. May 2012 20:10

Interesting that it is all written in Pascal. Cheers, JSW
johnswolter
 
Posts: 7
Joined: 09. July 2011 19:07


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 36 guests