-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path02-presentation.html
More file actions
266 lines (248 loc) · 10.1 KB
/
02-presentation.html
File metadata and controls
266 lines (248 loc) · 10.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
<section id="presentation">
<section>
<h2>Architecture</h2>
</section>
<section>
<h3>Site statique / dynamique</h3>
<table>
<thead>
<tr>
<th>Statique</th>
<th>Dynamique</th>
</tr>
</thead>
<tbody>
<tr>
<td>HTML / CSS / JavaScript</td>
<td>HTML / CSS / JavaScript / PHP / SQL</td>
</tr>
<tr>
<td>.html</td>
<td>.php</td>
</tr>
<tr>
<td>Modification du contenu des pages en HTML</td>
<td>Modification du contenu des pages à l'aide de formulaires</td>
</tr>
<tr>
<td>Les internautes ne peuvent pas effectuer d’action entraînant une modification du site internet</td>
<td>Les internautes peuvent modifier les données affichées sur les pages web</td>
</tr>
</tbody>
</table>
</section>
<section>
<h3>Statique / Dynamique</h3>
<p>Le langage PHP va nous permettre :</p>
<ul>
<li>D’afficher des données provenant d’une base de données</li>
<li>De gérer des connexions utilisateur</li>
<li>De stocker des informations sur la session de l’utilisateur en cours</li>
<li>De générer du code HTML, CSS ou Javascript</li>
<li>D’envoyer des mails</li>
<li>...</li>
</ul>
</section>
<section>
<h3>Architecture client - serveur</h3>
<p>Génération d’une page “unique” pour chaque internaute</p>
<p>Les clients (ou navigateurs web) ne peuvent pas comprendre le code PHP</p>
</section>
<section>
<h3>Historique</h3>
<p>Le langage PHP a été créé en <strong>1994</strong> par Rasmus Lerdorf.</p>
<p>Ce qui au départ était un <strong>projet personnel</strong> est devenu par la suite le langage le plus utilisé pour le développement de site web (environ 3 sites sur 4).</p>
<div class="container">
<div class="col">
<blockquote>
<p>
I don't know how to stop it, there was never any intent to write a programming language [...]
I have absolutely no idea how to write a programming language, I just kept adding the next logical step on the way.
</p>
<cite>Rasmus Lerdorf</cite>
</blockquote>
</div>
<div class="col">
<img src="assets/images/rasmus_lerdorf.jpg" alt="Rasmus Lerdorf">
</div>
</div>
</section>
<section>
<h3>Historique</h3>
<table>
<thead>
<tr>
<th>Date</th>
<th>Version</th>
<th>Fonctionnalités</th>
</tr>
</thead>
<tbody>
<tr>
<td>1995</td>
<td>PHP/FI</td>
<td>Création du langage / connexion <abbr title="Base De Données">BDD</abbr> / Cookies</td>
</tr>
<tr>
<td>1997</td>
<td>PHP/FI 2</td>
<td>Gestion des formulaires</td>
</tr>
<tr>
<td>1998</td>
<td>PHP 3</td>
<td>Création de la première version stable / <abbr title="Object Oriented Programming">OOP</abbr></td>
</tr>
<tr>
<td>2000</td>
<td>PHP 4</td>
<td>Super globales</td>
</tr>
<tr>
<td>2004</td>
<td>PHP 5</td>
<td>
<ul style="font-size: 0.8em;">
<li>5.0 (2004) : Improved <abbr title="Object Oriented Programming">OOP</abbr> / <abbr title="PHP Data Objects">PDO</abbr></li>
<li>5.1 (2005) : Minor changes</li>
<li>5.2 (2006) : Minor changes</li>
<li>5.3 (2009) : Namespaces / Closures / MySQLi / PHP-<abbr title="FastCGI Process Manager">FPM</abbr></li>
<li>5.4 (2012) : Traits / Brackets array / Internal web server</li>
<li>5.5 (2013) : Yield (generator) / password_hash() / OPcache / mysql_ functions deprecated</li>
<li>5.6 (2014) : Spread operator (...) Namespaces with const and functions</li>
</ul>
</td>
</tr>
</tbody>
</table>
</section>
<section>
<h3>Historique</h3>
<p style="text-align: center; font-size: 2em;">PHP 6 💀</p>
<p>Version abandonnée à cause de mauvais choix sur l'encodage Unicode.</p>
</section>
<section>
<h3>Historique</h3>
<table>
<thead>
<tr>
<th>Date</th>
<th>Version</th>
<th>Fonctionnalités</th>
</tr>
</thead>
<tbody>
<tr>
<td>2015</td>
<td>PHP 7</td>
<td>
<ul>
<li>7.0 (2015) : Huge performance enhancements</li>
<li>7.1 (2016) : fonction void / types nullables / visibilité des constantes</li>
<li>7.2 (2017) : object type / Argon2</li>
<li>7.3 (2018) : Legacy code deprecations</li>
<li>7.4 (2019) : Typed properties / Underscore numeric separator</li>
</ul>
</td>
</tr>
<tr>
<td>2020</td>
<td>PHP 8</td>
<td>
<ul>
<li>8.0 (2020) : Union type / <abbr title="Just In Time compilation">JIT</abbr> / Constructor Property Promotion / Named Parameters</li>
<li>8.1 (2021) : Enums / never return type / Intersection Types / readonly properties</li>
<li>8.2 (2022) : readonly classes / null, false, and true types</li>
</ul>
</td>
</tr>
</tbody>
</table>
<footer>
<a href="https://php.watch/versions" class="info" target="_blank">Évolution des dernières versions de PHP</a>
</footer>
</section>
<section>
<h3>MAMP</h3>
<p>Nous allons utiliser l’ensemble de logiciels suivant :</p>
<ul>
<li><strong>M</strong>acintosh</li>
<li><strong>A</strong>pache</li>
<li><strong>M</strong>ySQL</li>
<li><strong>P</strong>HP</li>
</ul>
<hr>
<ul>
<li><a href="https://www.mamp.info" target="_blank">Télécharger MAMP</a></li>
<li><a href="http://www.wampserver.com" target="_blank">Télécharger WAMP</a></li>
</ul>
</section>
<section>
<h3>Autres ensembles</h3>
<ul>
<li>LAMP (Linux / Apache / MySQL / PHP)</li>
<li>WISA (Windows / IIS / SQL Server / ASP.NET)</li>
<li>MEAN (MongoDB / ExpressJS / AngularJS / NodeJS)</li>
</ul>
</section>
<section>
<h3>Dossier du serveur web</h3>
<ul>
<li>MAMP : /Applications/MAMP/htdocs</li>
<li>WAMP : c:/wamp64/www</li>
<li>LAMP : /var/www</li>
</ul>
</section>
<section>
<h3>URLs</h3>
<ul>
<li>MAMP : <a href="http://localhost:8888" target="_blank">http://localhost:8888</a></li>
<li>WAMP : <a href="http://localhost" target="_blank">http://localhost</a></li>
<li>LAMP : <a href="http://localhost" target="_blank">http://localhost</a></li>
</ul>
<footer>
<a href="#" class="info">80 est le port HTTP par défaut (443 pour HTTPS)</a>
</footer>
</section>
<section>
<h3>Ecrire du code PHP</h3>
<p>Pour écrire du code PHP, il faut que l’extension du fichier soit en .php et ensuite utiliser les balises suivantes :</p>
<pre><code class="language-php"><h1>Bonjour <?php echo $prenom; ?></h1></code></pre>
<p>Ce code pourra produire différents résultats en fonction de la valeur de la variable <code class="language-php">$prenom</code>.</p>
</section>
<section>
<h3>Afficher les erreurs</h3>
<p>Par défaut, les erreurs PHP ne sont pas affichées sur MAMP.</p>
<p>Pour afficher les erreurs, il faut modifier la valeur <code class="language-ini">display_errors</code> du fichier php.ini</p>
<footer>
<a href="#" class="warning">Il existe un fichier php.ini par version de PHP</a>
</footer>
</section>
<section>
<h3>Localiser le fichier php.ini</h3>
<p>Le dossier de MAMP contient un fichier php.ini pour chaque version de PHP installée.</p>
<p>Pour connaitre l'emplacement du fichier php.ini, vous pouvez appeler la fonction PHP <code class="language-php">phpinfo()</code> puis actualiser la page web du navigateur :</p>
<img src="assets/images/phpinfo.png" alt="phpinfo">
<footer>
<a href="#" class="warning" style="font-size: 0.8em;">Redémarrez le serveur Apache pour que les modifications soient prises en compte</a>
</footer>
</section>
<section>
<h3>Modifier le fichier php.ini</h3>
<p>Ouvrez ensuite de fichier et rechercher la ligne <code class="language-ini">display_errors</code>.</p>
<p>Modifier cette ligne pour la passer à "On" :</p>
<pre><code class="language-ini">display_errors = On</code></pre>
<p>Redémarrer ensuite le serveur Apache pour prendre en compte la modification.</p>
</section>
<section>
<h3>Commentaires</h3>
<p>Attention ! Les commentaires en PHP ne s’écrivent pas comme en HTML :</p>
<pre><code class="language-php"><?php
// Commentaire sur une ligne en PHP
/*
Commentaire sur plusieurs lignes
en PHP
*/
?></code></pre>
</section>
</section>