<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head>  <title>PHP: Une introduction  PHP - Manual</title>  <link rel="stylesheet" href="/style.css" />  <link rel="shortcut icon" href="/favicon.ico" />  </head> <body topmargin="0" leftmargin="0" marginheight="0" marginwidth="0"  bgcolor="#ffffff" text="#000000" link="#000099" alink="#0000ff"  vlink="#000099">  <table border="0" cellspacing="0" cellpadding="0" height="48" width="100%">  <tr bgcolor="#9999cc">   <td align="center" rowspan="2" width="126"><a href="/"><img src="/images/php.gif" border="0" width="120" height="67" alt="PHP"  hspace="3" /></a></td>   <td>&nbsp;</td>  </tr>  <tr bgcolor="#9999cc">   <td align="right" valign="bottom"> <a href="/downloads.php" class="small">downloads</a> | <a href="/docs.php" class="small">documentation</a> | <a href="/my.php" class="small">my php.net</a> | <a href="/FAQ.php" class="small">faq</a> | <a href="/support.php" class="small">getting help</a> | <a href="/mailing-lists.php" class="small">mailing lists</a> | <a href="http://bugs.php.net/" class="small">reporting bugs</a> | <a href="/sites.php" class="small">php.net sites</a> | <a href="/links.php" class="small">links</a>&nbsp;   </td>  </tr>  <tr bgcolor="#333366"><td colspan="2"><img src="/images/spacer.gif" width="1" height="1" border="0" alt=""  /></td></tr>  <tr bgcolor="#666699">    <td align="right" valign="top" colspan="2"><font color="#ffffff">     <form method="post" action="/search.php" class="thin"> <input type="hidden" name="lang" value="fr" /><small><span title="Keyboard shortcut: Alt+S (Win), Ctrl+S (Apple)"><u>s</u>earch for</span></small> <input class="small" type="text" name="pattern" value="" size="30" accesskey="s" /> <small>in the</small> <select name="show" class="small"> <option value="quickref" selected="selected">function list</option> <option value="wholesite">whole site</option> <option value="manual">online documentation [en]</option> <option value="bugdb">bug database</option> <option value="maillist">general mailing list</option> <option value="devlist">developer mailing list</option> <option value="phpdoc">documentation mailing list </option> </select> <input type="image" src="/images/small_submit_white.gif" border="0" width="11" height="11" alt="search"  align="bottom" />&nbsp; </form> </font>    </td>  </tr>  <tr bgcolor="#333366"><td colspan="3"><img src="/images/spacer.gif" width="1" height="1" border="0" alt=""  /></td></tr>  </table>   <table border="0" cellpadding="0" cellspacing="0">  <tr valign="top">   <td width="200" bgcolor="#f0f0f0">    <table width="100%" cellpadding="2" cellspacing="0" border="0">     <tr valign="top"><td class="sidebar"><table border="0" cellpadding="0" cellspacing="5" width="100%"><tr valign="top"><td><a href="./"><img src="/images/caret-t.gif" border="0" width="11" height="7" alt="^"  />Manuel PHP</a><br></td></tr><tr bgcolor="#cccccc"><td><img src="/images/spacer.gif" width="1" height="1" border="0" alt=""  /></td></tr><tr valign="top"><td><a href="getting-started.php"><img src="/images/caret-u.gif" border="0" width="11" height="7" alt="&lt;"  />Comment commencer</a></td></tr><tr valign="top"><td><small class="sidetoc">&nbsp;<a href="introduction.php"><img src="/images/box-0.gif" border="0" width="11" height="7" alt="&middot;"  />Introduction</a><br /> &nbsp;<a href="tutorial.php"><img src="/images/box-1.gif" border="0" width="11" height="7" alt="&middot;"  /><b>Une introduction  PHP</b></a><br /> &nbsp;<a href="installation.php"><img src="/images/box-0.gif" border="0" width="11" height="7" alt="&middot;"  />Installation</a><br /> &nbsp;<a href="configuration.php"><img src="/images/box-0.gif" border="0" width="11" height="7" alt="&middot;"  />Configuration</a><br /> &nbsp;<a href="security.php"><img src="/images/box-0.gif" border="0" width="11" height="7" alt="&middot;"  />Scurit</a><br /> </small></td></tr></table></td></tr>    </table>   </td>   <td bgcolor="#cccccc" background="/images/checkerboard.gif" width="1"><img src="/images/spacer.gif" width="1" height="1" border="0" alt=""  /></td>   <td>    <table cellpadding="10" cellspacing="0" width="100%">     <tr><td valign="top"> <table border="0" width="100%" bgcolor="#e0e0e0" cellpadding="0" cellspacing="4"><tr><td><a href="intro-whatcando.php"><img src="/images/caret-l.gif" border="0" width="11" height="7" alt="&lt;"  />Que peut faire PHP?</a></td><td align="right"><a href="tutorial.firstpage.php">Votre premire page PHP<img src="/images/caret-r.gif" border="0" width="11" height="7" alt="&gt;"  /></a></td></tr><tr bgcolor="#cccccc"><td colspan="2"><img src="/images/spacer.gif" width="1" height="1" border="0" alt=""  /></td></tr><tr><td><form action="/manual/change.php" method="GET" class="thin"><small>view the </small><select name="page" class="small"> <option value="fr/print/tutorial.php">printer friendly</option> <option value="fr/printwn/tutorial.php">printer friendly [+notes]</option> <option value="en/tutorial.php">English</option> <option value="pt_BR/tutorial.php">Brazilian Portuguese</option> <option value="zh/tutorial.php">Chinese (Simplified)</option> <option value="hk/tutorial.php">Chinese (Hong Kong Cantonese)</option> <option value="tw/tutorial.php">Chinese (Traditional)</option> <option value="cs/tutorial.php">Czech</option> <option value="nl/tutorial.php">Dutch</option> <option value="fi/tutorial.php">Finnish</option> <option value="de/tutorial.php">German</option> <option value="hu/tutorial.php">Hungarian</option> <option value="it/tutorial.php">Italian</option> <option value="ja/tutorial.php">Japanese</option> <option value="kr/tutorial.php">Korean</option> <option value="pl/tutorial.php">Polish</option> <option value="ro/tutorial.php">Romanian</option> <option value="ru/tutorial.php">Russian</option> <option value="sk/tutorial.php">Slovak</option> <option value="sl/tutorial.php">Slovenian</option> <option value="es/tutorial.php">Spanish</option> <option value="sv/tutorial.php">Swedish</option> </select><input type="image" src="/images/small_submit.gif" border="0" width="11" height="11" alt="" align="baseline"> <small>version of this page</small></form></td><td align="right" valign="bottom"><small>Last updated: Sun, 20 Apr 2003</small></td></tr></table> <!--/UdmComment--><DIV CLASS="chapter" ><H1 ><A NAME="tutorial" ></A >Chapitre 2. Une introduction  PHP</H1 ><DIV CLASS="TOC" ><DL ><DT ><B >Table des matires</B ></DT ><DT ><A HREF="tutorial.php#tutorial.requirements" >Le ncessaire</A ></DT ><DT ><A HREF="tutorial.firstpage.php" >Votre premire page PHP</A ></DT ><DT ><A HREF="tutorial.useful.php" >Trucs pratiques</A ></DT ><DT ><A HREF="tutorial.forms.php" >Utiliser un formulaire</A ></DT ><DT ><A HREF="tutorial.oldcode.php" >Utiliser des codes anciens avec les nouvelles versions de PHP</A ></DT ><DT ><A HREF="tutorial.whatsnext.php" >Et aprs?</A ></DT ></DL ></DIV ><P >&#13;   Dans cette section, nous voulons illustrer les principes de base    de PHP dans une courte introduction. Ce chapitre traite uniquement    de crations de pages web dynamiques avec PHP, laissant de cot    temporairement les autres possibilits de PHP. Voyez la section    <A HREF="intro-whatcando.php" >Ce que peut faire PHP</A > pour     plus d'informations.   </P ><P >&#13;   Les pages web qui exploitent PHP sont traites comme des pages    HTML standards, et vous pouvez les crer, diter et effacer    tout comme vous le faites normalement avec des pages HTML    classiques.   </P ><DIV CLASS="sect1" ><H1 CLASS="sect1" ><A NAME="tutorial.requirements" ></A >Le ncessaire</H1 ><P >&#13;    Dans ce tutoriel, nous prsumons que vous avez un serveur     web avec le support PHP activ, et que les fichiers termins     par l'extension <TT CLASS="filename" >.php</TT > sont traits par     PHP. Sur la plupart des serveurs, c'est la configuration par     dfaut, mais n'hsitez pas  interroger votre administrateur     systme en cas de doute. Si votre serveur web supporte PHP,     vous n'avez rien  faire. Simplement, crez un dossier,     puis crez un fichier texte, avec l'extension <TT CLASS="filename" >.php</TT > :     le serveur va automatiquement l'excuter avec PHP. Il n'y a pas     de compilation, ou d'installation complique. Gardez en tte que     les fichiers sont comparables  des fichiers HTML, dans lequels     vous allez utiliser des balises magiques, qui feront beaucoup     de choses pour vous.    </P ><P >&#13;    Supposons que vous souhaitiez conomiser du temps en ligne et travailler     localement. Dans ce cas, vous devez installer un serveur web comme     <A HREF="install.apache.php" >Apache</A >, et bien sur     <A HREF="http://www.php.net/downloads.php" TARGET="_top" >PHP</A >.  Vous souhaiterez     aussi installer une base de donnes comme par exemple      <A HREF="http://www.mysql.com/documentation/" TARGET="_top" >MySQL</A >.  Vous pouvez     installer ces logiciels individuellement, ou bien avec      <A HREF="http://www.hotscripts.com/PHP/Software_and_Servers/Installation_Kits/" TARGET="_top" >des installeurs</A >      qui prennent en charge l'ensemble de l'installation en quelques     clics. Il est facile de configurer un serveur web avec le support     de <TT CLASS="literal" >PHP</TT > sur n'importe quel systme d'exploitation, y compris     Linux et Windows. Sous Linux, vous pouvez aussi trouver     des commandes comme <A HREF="http://www.rpmfind.net/" TARGET="_top" >rpmfind</A >,     trs pratique pour rechercher les paquets pr compils.    </P ></DIV ></DIV ><table border="0" cellpadding="4" cellspacing="0" width="100%"> <tr bgcolor="#d0d0d0" valign="top"> <td><small>User Contributed Notes</small><br /><b>Une introduction  PHP</b></td> <td align="right"><a href="/manual/add-note.php?sect=tutorial&redirect=http://php.crihan.fr/manual/fr/tutorial.php"><img src="/images/notes-add.gif" border="0" width="13" height="13" alt="add a note"  /></a>&nbsp;<a href="/manual/about-notes.php"><img src="/images/notes-about.gif" border="0" width="13" height="13" alt="about notes"  /></a></td> </tr> <tr valign="top"> <td bgcolor="#e0e0e0" colspan="2"> <a name="#24750"></a><table border="0" cellpadding="2" cellspacing="0" width="100%"> <tr valign="top"><td> <b>Matthew at ggraham2 dot fsnet dot co dot uk</b><br> 27-Aug-2002 09:34</td> <td align="right"> <br></td> </tr> <tr bgcolor="#f0f0f0"><td colspan="2"> <code class="note">Bear in mind that PHP is a service that the web server has to provide.  Most free web-page hosts, and ISPs giving space will not support PHP.</code><br> </td></tr> </table> </td> </tr> <tr valign="top"> <td bgcolor="#e0e0e0" colspan="2"> <a name="#26480"></a><table border="0" cellpadding="2" cellspacing="0" width="100%"> <tr valign="top"><td> <b>vjptl at yahoo dot com</b><br> 01-Nov-2002 06:00</td> <td align="right"> <br></td> </tr> <tr bgcolor="#f0f0f0"><td colspan="2"> <code class="note">You can easily setup PHP + Apache + MySQL in RedHat Linux 7.x. Just install the rpms for PHP, Apache, and Mysql from the RH CDs and you are there... <br>Go to /var/www/html directory and create a file 'info.php' with a single line in it... <br> <br>&lt;?php phpinfo() ?&gt; <br> <br>Start Apache if it is not already running... the access the page with a browser. Voila!!</code><br> </td></tr> </table> </td> </tr> <tr valign="top"> <td bgcolor="#e0e0e0" colspan="2"> <a name="#28420"></a><table border="0" cellpadding="2" cellspacing="0" width="100%"> <tr valign="top"><td> 12-Jan-2003 11:10</td> <td align="right"> <br></td> </tr> <tr bgcolor="#f0f0f0"><td colspan="2"> <code class="note">For easy to install packages of Apache, MySQL, PHP and Pearl look at <a href="http://www.apachefriends.org">http://www.apachefriends.org</a></code><br> </td></tr> </table> </td> </tr> <tr valign="top"> <td bgcolor="#e0e0e0" colspan="2"> <a name="#28441"></a><table border="0" cellpadding="2" cellspacing="0" width="100%"> <tr valign="top"><td> <b>goatguy at geek dot com</b><br> 13-Jan-2003 06:36</td> <td align="right"> <br></td> </tr> <tr bgcolor="#f0f0f0"><td colspan="2"> <code class="note">[[[Editors note: This is specific to certain web servers such as IIS or PWS when runnin as CGI. &nbsp;See this faq: <br> <br><a href="http://www.php.net/manual/en/faq.installation.php#faq.installation.forceredirect">http://www.php.net/manual/en/faq.installation.php#faq.installation.forceredirect</a> <br>]]] <br>*** 1st time WINDOWS *** and force-cgi issues... <br>Simply put, you need to go into PHP.INI (found either in \windows, or \win32, depending on O/S) and uncomment the line &quot;cgi.force_redirect&quot; and set it to ***ZERO***. &nbsp;Then, suddenly &quot;hello.php&quot; works for you.</code><br> </td></tr> </table> </td> </tr> <tr valign="top"> <td bgcolor="#e0e0e0" colspan="2"> <a name="#29246"></a><table border="0" cellpadding="2" cellspacing="0" width="100%"> <tr valign="top"><td> <b>spensyr at yahoo dot com</b><br> 07-Feb-2003 12:21</td> <td align="right"> <br></td> </tr> <tr bgcolor="#f0f0f0"><td colspan="2"> <code class="note">One good book for getting started is PHP FAST &amp; EASY WEB DEVELOPMENT, 2ND EDITION, by JULIE C. MELON. The publishers added to the 2nd Edition three beginning chapters that detailed, easy-to-follow download/setup instructions for MySQL, Apache Web Server, and PHP respectively on both Windows and Linux. Too many beginning programming books assume you've already got your development environment setup, so this book was a breath of fresh air for me as I took up PHP for the first time.</code><br> </td></tr> </table> </td> </tr> <tr valign="top"> <td bgcolor="#e0e0e0" colspan="2"> <a name="#29327"></a><table border="0" cellpadding="2" cellspacing="0" width="100%"> <tr valign="top"><td> <b>www.leestanley.co.uk</b><br> 10-Feb-2003 04:51</td> <td align="right"> <br></td> </tr> <tr bgcolor="#f0f0f0"><td colspan="2"> <code class="note">PHP will not run on Yahoo! Geocities<br><br>However if you're looking for a free webspace provider that will, I would suggest the UK version of Lycos Tripod at <a href="http://www.tripod.lycos.co.uk/">http://www.tripod.lycos.co.uk/</a> - other benefits include the fact that banners won't show up on its PHP pages, you can have FTP access, and you can remotely link to files (although you're not really supposed to, you can).</code><br> </td></tr> </table> </td> </tr> <tr valign="top"> <td bgcolor="#e0e0e0" colspan="2"> <a name="#29501"></a><table border="0" cellpadding="2" cellspacing="0" width="100%"> <tr valign="top"><td> <b>therey at altern dot org</b><br> 15-Feb-2003 05:39</td> <td align="right"> <br></td> </tr> <tr bgcolor="#f0f0f0"><td colspan="2"> <code class="note">To setup easily php, mysql and phpmyadmin, download easyphp at easyphp dot org (french)</code><br> </td></tr> </table> </td> </tr> <tr valign="top"> <td bgcolor="#e0e0e0" colspan="2"> <a name="#30483"></a><table border="0" cellpadding="2" cellspacing="0" width="100%"> <tr valign="top"><td> <b>mages at mysticsoftware dot net</b><br> 19-Mar-2003 03:31</td> <td align="right"> <br></td> </tr> <tr bgcolor="#f0f0f0"><td colspan="2"> <code class="note">If you plan to create your PHP site locally offline (like I did), be wary of the settings you define in the php.ini file. By default, most servers appear to disable register_globals nowadays, so caution is advised in creating your site with it enabled. Also, some servers report errors if you try to display a previously unused variable. Working around these will save you a lot of hassle when you come to uploading your site.</code><br> </td></tr> </table> </td> </tr> <tr valign="top"> <td bgcolor="#e0e0e0" colspan="2"> <a name="#30502"></a><table border="0" cellpadding="2" cellspacing="0" width="100%"> <tr valign="top"><td> <b>caezar at jippii dot ee</b><br> 20-Mar-2003 04:11</td> <td align="right"> <br></td> </tr> <tr bgcolor="#f0f0f0"><td colspan="2"> <code class="note">phptriad is also a good choice for beginner php programmers</code><br> </td></tr> </table> </td> </tr> <tr valign="top"> <td bgcolor="#e0e0e0" colspan="2"> <a name="#30719"></a><table border="0" cellpadding="2" cellspacing="0" width="100%"> <tr valign="top"><td> <b>aqdev at hotmail dot com</b><br> 26-Mar-2003 06:52</td> <td align="right"> <br></td> </tr> <tr bgcolor="#f0f0f0"><td colspan="2"> <code class="note">There is a great development environment available free from evrsoft.</code><br> </td></tr> </table> </td> </tr> <tr valign="top"> <td bgcolor="#e0e0e0" colspan="2"> <a name="#31151"></a><table border="0" cellpadding="2" cellspacing="0" width="100%"> <tr valign="top"><td> <b>gescape at o2 dot pl</b><br> 11-Apr-2003 12:00</td> <td align="right"> <br></td> </tr> <tr bgcolor="#f0f0f0"><td colspan="2"> <code class="note">Very easy for beginners is FoxServ v.3.0.</code><br> </td></tr> </table> </td> </tr> <tr bgcolor="#d0d0d0" valign="top"> <td colspan="2" align="right"> <a href="/manual/add-note.php?sect=tutorial&redirect=http://php.crihan.fr/manual/fr/tutorial.php"><img src="/images/notes-add.gif" border="0" width="13" height="13" alt="add a note"  /></a>&nbsp;<a href="/manual/about-notes.php"><img src="/images/notes-about.gif" border="0" width="13" height="13" alt="about notes"  /></a></td> </tr> </table> <br /><table border="0" width="100%" bgcolor="#e0e0e0" cellpadding="0" cellspacing="4"><tr><td><a href="intro-whatcando.php"><img src="/images/caret-l.gif" border="0" width="11" height="7" alt="&lt;"  />Que peut faire PHP?</a></td><td align="right"><a href="tutorial.firstpage.php">Votre premire page PHP<img src="/images/caret-r.gif" border="0" width="11" height="7" alt="&gt;"  /></a></td></tr><tr bgcolor="#cccccc"><td colspan="2"><img src="/images/spacer.gif" width="1" height="1" border="0" alt=""  /></td></tr><tr><td><small>&nbsp;</small></td><td align="right" valign="bottom"><small>Last updated: Sun, 20 Apr 2003</small></td></tr></table> </td></tr></table></td></tr></table>  <table border="0" cellspacing="0" cellpadding="0" width="100%">  <tr bgcolor="#333366"><td><img src="/images/spacer.gif" width="1" height="1" border="0" alt=""  /></td></tr>  <tr bgcolor="#9999cc">   <td align="right" valign="bottom"> <a href="/source.php?url=/manual/fr/tutorial.php" class="small">show source</a> | <a href="/credits.php" class="small">credits</a> | <a href="/stats/" class="small">stats</a> | <a href="/mirrors.php" class="small">mirror sites</a>&nbsp;  </td>  </tr>  <tr bgcolor="#333366"><td><img src="/images/spacer.gif" width="1" height="1" border="0" alt=""  /></td></tr> </table>  <table border="0" cellspacing="0" cellpadding="6" width="100%">  <tr valign="top" bgcolor="#cccccc">   <td><small><a href="/copyright.php">Copyright &copy; 2001-2003 The PHP Group</a><br />All rights reserved.</small></td>   <td align="right"><small>    <a href="/mirror.php">This mirror</a> generously provided by:    <a href="http://www.crihan.fr/">Crihan</a><br />    Last updated: <url-minder-ignore>Fri Apr 25 18:09:26 2003 CEST</url-minder-ignore>    </small>   </td>  </tr> </table> <!--/UdmComment--> </body> </html> 
