PHP is a serverside language, which means that your code has to pass through the PHP interpreter, which returns the output to the users browser. That's why you need a webserver installed locally to test your code. By default, when you select preview, WebCoder will show your file by opening the local file in the preview browser, but that won't work for a PHP file, since it has to go through the server. You will need to tell WebCoder how a file path maps to the local webserver. The servermapping feature helps us do just that.
In a previous chapter, we configured the Apache webserver to work on your computer. Now you will need your localhost address, as setup earlier. Usually, it's http://localhost/ or http://localhost:8080/. In WebCoder, go to Functions and select Settings. Now, select the Preview tab and then the Servermappings tab. Make sure that the "Enable servermappings" checkbox is checked. In the "Edit servermapping" part of the dialog, enter your local document root in the first field, and your localhost address in the second field. In case you used the default values while installing Apache, the values should look something like this:
Path: C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\ URL: http://localhost:8080/
Check that these values work on your machine and then click the Add button. Now, click Ok in the dialog and you're good to go. If you wish to test your new setup, enter some PHP code in a document (try the Hello world chapter in this tutorial, for instance), save it in your document root (C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\) and then press F12 in WebCoder to preview it.