Why do you need a web-server?
All browsers understand only HTML,CSS and JS. The browser cannot interpret PHP or any other server side language. So you need some mechanism to convert PHP to HTML.
This is taken care by web-server. apache is the open source webserver used to serve PHP.
How to use a web-server?
Install the web-server then you need to configure it so as to have a directory(htdocs) to put all your code so that it can interpret and make browser understand the stuff.
Once you have configured it and start your webserver you can open it in a browser and can see the webserver serving HTML code even though you give it PHP code.