TOC

This article is currently in the process of being translated into French (~37% done).

The editor:

Previewing

PHP est un langage côté serveur, ce qui signifie que votre code doit passer par l'interpréteur PHP, qui renvoie la sortie au navigateur de l'utilisateur. C'est pourquoi vous avez besoin d'un serveur web installé localement pour tester votre code. Par défaut, lorsque vous sélectionnez l'aperçu, WebCoder affichera votre fichier en ouvrant le fichier local dans l'aperçu du navigateur, mais cela ne fonctionnera pas pour un fichier PHP, car il doit passer par le serveur. Vous devrez indiquer à WebCoder comment le chemin d'accès d'un fichier est mappé sur le serveur local. La fonction de mappage du serveur nous aide à le faire. Traduit avec www.DeepL.com/Translator (version gratuite)

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.


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!