Serveur php configurzation
ou: pourquoi il y a un problème lorsqu'on fait un double-clic pour ouvrir un fichier html ?
BIO30 "Programmez votre site web de A à Z" – Carl Herrmann – Université de la Méditerranée
(navigateur web) http://www.serveur.com/index.html client
serveur web
html
public_html/
html index.html BIO30 "Programmez votre site web de A à Z" – Carl Herrmann – Université de la Méditerranée
(navigateur web) file://index.html client
serveur web
html
public_html/
index.html
BIO30 "Programmez votre site web de A à Z" – Carl Herrmann – Université de la Méditerranée
(navigateur web) http://www.serveur.com/script.php client
serveur web
html
public_html/
php index.html BIO30 "Programmez votre site web de A à Z" – Carl Herrmann – Université de la Méditerranée
(navigateur web) file://script.php client
serveur web
? public_html/ php
index.html
BIO30 "Programmez votre site web de A à Z" – Carl Herrmann – Université de la Méditerranée
Conclusion
un navigateur web ne comprend que l'html les fichiers html et php doivent "être servis" par le … serveur web (d'où son nom) donc: http://localhost/script.html et non file://script.html
BIO30 "Programmez votre site web de A à Z" – Carl Herrmann – Université de la Méditerranée
Structure d'un programme PHP
BIO30 "Programmez votre site web de A à Z" – Carl Herrmann – Université de la Méditerranée
html
commentaire
indentation
bloc
BIO30 "Programmez votre site web de A à Z" – Carl Herrmann – Université de la Méditerranée
Bloc PHP
Commentaires
Bloc d'instructions
toutes les lignes d'instructions en PHP se terminent par un ; sauf celles qui ouvrent un bloc
BIO30 "Programmez votre site web de A à Z" – Carl Herrmann – Université de la Méditerranée
Conseil de présentation !
Bloc d'instructions
les instructions dans un bloc sont indentées par rapport aux