TOC

The community is working on translating this tutorial into Portuguese, but it seems that no one has started the translation process for this article yet. If you can help us, then please click "More info".

Requirements:

Using the webserver

Once we have installed Apache and PHP, we can start executing PHP code on our own computer. But how does it work? It's actually quite simple. Once we installed PHP, it hooked into Apache, and made the necessary changes to the configuration files to allow Apache to communicate with PHP and get the PHP code interpreted and returned to the client.

When we installed the Apache server, a directory called htdocs was created. This directory with the unusual name is the gate to our webserver - everything within it is also available through the HTTP protocol and thereby a browser. Depending on how you installed Apache, the files in the htdocs folder can be accessed through http://localhost/ or http://localhost:8080/ (remember to start Apache before testing these URL's). Files can be reached by appending the filename to the above address, and the same goes for folders, which can be accessed by appending the foldername to the address. A file within a set of subfolders can be reached like this: http://localhost/folder1/folder2/filename.php.

Within this tutorial, we save the files to the htdocs folder, and then access it through the browser with the localhost URL, to get the code interpreted by PHP and returned to the browser.


This article has been fully translated into the following languages: Is your preferred language not on the list? Click here to help us translate this article into your language!