Skip to content
Advertisement

How do web servers work for website viewers without even installing it?

I am really new to server-side programming, so this question might be easy for you.

Let us say that I have a web-server installed on my computer. When I publish my website, it would come to the internet. I have XAMPP installed, which includes everything required. Now, most of the people who visit my website would not have a server/PHP/MySQL installed. I know that almost all the web hosting companies support PHP and MySQL.

However, when other people view my website, how would their local network take all the database and server data from my computer? Any help would really be appreciated. Thankyou!

Advertisement

Answer

When you install XAMP you are installing the various server processes to provide web services – Apache, PHP, MySQL.

When you run a browser on your computer it communicates with these processes exactly as if they were on a remote server, but the server happens to be on your machine.

For other users on your network, their browsers will communicate with the Apache process on your machine, which will use the PHP and MySQL instances on your machine to service the request.

This is exactly analogous to a browser communicating with a web site on the public Internet, where the web services are installed on a remote server, and are not required on your own computer.

Note that there may be other configuration changes required for users to use the web site on your own machine – firewall changes and possibly changes to the hosts file or local DNS.

If you’re running a development machine I wouldn’t recommend you share your web services, but install them on a separate local server for local use.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement