|
1 |
| -Symfony Standard Edition |
2 |
| -======================== |
| 1 | +============================================================================== |
| 2 | + I. Annexe I : Installation sous Linux |
| 3 | +============================================================================== |
3 | 4 |
|
4 |
| -Welcome to the Symfony Standard Edition - a fully-functional Symfony2 |
5 |
| -application that you can use as the skeleton for your new applications. |
| 5 | +On va voir dans ce chapitre les points à vérifier pour déployer l’application sur un serveur linux. La méthodologie est la suivante : |
6 | 6 |
|
7 |
| -This document contains information on how to download, install, and start |
8 |
| -using Symfony. For a more detailed explanation, see the [Installation][1] |
9 |
| -chapter of the Symfony Documentation. |
| 7 | +1) Vérifier et préparer le serveur de production |
| 8 | +------------------------------------------------ |
10 | 9 |
|
11 |
| -1) Installing the Standard Edition |
12 |
| ----------------------------------- |
| 10 | +Évidemment, pour déployer une application Symfony2 sur votre serveur, encore faut-il que celui-ci soit compatible avec les besoins de Symfony2 ! Pour vérifier cela, on peut distinguer deux cas. |
| 11 | +Symfony2 intègre un petit fichier PHP qui fait toutes les vérifications de compatibilité nécessaires, Il s'agit du fichier web/config.php, envoyez le sur votre serveur. Ouvrez la page web qui lui correspond, par exemple www.votre-serveur.com/config.php. Vous devriez obtenir soit des alertes "Major Problems" que vous devez corriger ou juste des Recommandations essayez de les respecter si cela est possible. |
13 | 12 |
|
14 |
| -When it comes to installing the Symfony Standard Edition, you have the |
15 |
| -following options. |
| 13 | +2) Pré-requis au bon fonctionnement de Symfony2 |
| 14 | +----------------------------------------------- |
16 | 15 |
|
17 |
| -### Use Composer (*recommended*) |
| 16 | +Voici les points obligatoires qu'il faut que votre serveur respecte pour pouvoir faire tourner Symfony2 : |
| 17 | +- PHP doit être au minimum à la version PHP 5.3.3 |
| 18 | +- JSON doit être activé |
| 19 | +- ctype doit être activé |
| 20 | +- Votre PHP.ini doit avoir le paramètre date.timezone défini |
| 21 | +- installer le driver PDO |
18 | 22 |
|
19 |
| -As Symfony uses [Composer][2] to manage its dependencies, the recommended way |
20 |
| -to create a new project is to use it. |
| 23 | +3) Installer wkhtmltopdf |
| 24 | +----------------------------------------------- |
21 | 25 |
|
22 |
| -If you don't have Composer yet, download it following the instructions on |
23 |
| -http://getcomposer.org/ or just run the following command: |
| 26 | +Wkhtmltopdf un outil qui permet de générer des PDF, il est utilisé dans l'application pour imprimer les badges des adhérents. |
| 27 | +# apt-get install wkhtmltopdf |
| 28 | +Âpres l'installation modifier le fichier de configuration app/config/config.yml afin de spécifier le chemin absolue de wkhtmltopdf. |
24 | 29 |
|
25 |
| - curl -s https://getcomposer.org/installer | php |
| 30 | +4) Envoyer les fichiers sur le serveur |
| 31 | +----------------------------------------------- |
26 | 32 |
|
27 |
| -Then, use the `create-project` command to generate a new Symfony application: |
28 | 33 |
|
29 |
| - php composer.phar create-project symfony/framework-standard-edition path/to/install 2.1.x-dev |
| 34 | +Dans un premier temps, il faut bien évidemment envoyer les fichiers sur le serveur. Pour éviter d'envoyer des fichiers inutiles et lourds, videz dans un premier temps le cache de votre application en supprimant tout le contenu du repertoire app/cache. Ensuite, envoyez tous vos fichiers et dossiers à la racine de votre hébergement, dans www/ |
| 35 | +Important: |
| 36 | +Les fichiers dans le répertoire vendors/ sont assez lourds et prennent beaucoup de temps lors de l'uploada. Pour remédier à ce problème, sur votre serveur, exécutez la commande |
| 37 | + # php composer.phar install |
| 38 | +Cette commande qui va installer les mêmes versions des dépendances que vous avez en local. Cela se fait grâce au fichier composer.lock qui contient tous les numéros des versions installées justement. |
| 39 | +Si vous n'avez pas accès à Composer sur votre serveur, alors contentez-vous d'envoyer le dossier vendor en même temps que le reste de votre application. |
30 | 40 |
|
31 |
| -For an exact version, replace 2.1.x-dev with the latest Symfony version (e.g. 2.1.1). |
| 41 | +5) Régler les droits sur les dossiers app/cache et app/logs |
| 42 | +----------------------------------------------------------- |
32 | 43 |
|
33 |
| -Composer will install Symfony and all its dependencies under the |
34 |
| -`path/to/install` directory. |
35 | 44 |
|
36 |
| -### Download an Archive File |
| 45 | +Vous le savez maintenant, Symfony2 a besoin de pouvoir écrire dans deux répertoires : app/cache pour y mettre le cache de l'application et ainsi améliorer les performances, et app/logs pour y mettre l'historiques des informations et erreurs rencontrées lors de l'exécution des pages. Sur votre serveur, exécutez la commande suivante: |
| 46 | +# chmod 775 -R app/cache app/logs |
37 | 47 |
|
38 |
| -To quickly test Symfony, you can also download an [archive][3] of the Standard |
39 |
| -Edition and unpack it somewhere under your web server root directory. |
40 | 48 |
|
41 |
| -If you downloaded an archive "without vendors", you also need to install all |
42 |
| -the necessary dependencies. Download composer (see above) and run the |
43 |
| -following command: |
44 |
| - |
45 |
| - php composer.phar install |
46 |
| - |
47 |
| -2) Checking your System Configuration |
| 49 | +6) Mettre en place la base de données |
48 | 50 | -------------------------------------
|
49 | 51 |
|
50 |
| -Before starting coding, make sure that your local system is properly |
51 |
| -configured for Symfony. |
52 |
| - |
53 |
| -Execute the `check.php` script from the command line: |
54 |
| - |
55 |
| - php app/check.php |
56 |
| - |
57 |
| -Access the `config.php` script from a browser: |
58 |
| - |
59 |
| - http://localhost/path/to/symfony/app/web/config.php |
60 |
| - |
61 |
| -If you get any warnings or recommendations, fix them before moving on. |
62 |
| - |
63 |
| -3) Browsing the Demo Application |
64 |
| --------------------------------- |
65 |
| - |
66 |
| -Congratulations! You're now ready to use Symfony. |
67 |
| - |
68 |
| -From the `config.php` page, click the "Bypass configuration and go to the |
69 |
| -Welcome page" link to load up your first Symfony page. |
70 |
| - |
71 |
| -You can also use a web-based configurator by clicking on the "Configure your |
72 |
| -Symfony Application online" link of the `config.php` page. |
73 |
| - |
74 |
| -To see a real-live Symfony page in action, access the following page: |
75 |
| - |
76 |
| - web/app_dev.php/demo/hello/Fabien |
77 |
| - |
78 |
| -4) Getting started with Symfony |
79 |
| -------------------------------- |
80 |
| - |
81 |
| -This distribution is meant to be the starting point for your Symfony |
82 |
| -applications, but it also contains some sample code that you can learn from |
83 |
| -and play with. |
84 |
| - |
85 |
| -A great way to start learning Symfony is via the [Quick Tour][4], which will |
86 |
| -take you through all the basic features of Symfony2. |
87 |
| - |
88 |
| -Once you're feeling good, you can move onto reading the official |
89 |
| -[Symfony2 book][5]. |
90 |
| - |
91 |
| -A default bundle, `AcmeDemoBundle`, shows you Symfony2 in action. After |
92 |
| -playing with it, you can remove it by following these steps: |
93 |
| - |
94 |
| - * delete the `src/Acme` directory; |
95 |
| - |
96 |
| - * remove the routing entries referencing AcmeBundle in |
97 |
| - `app/config/routing_dev.yml`; |
98 |
| - |
99 |
| - * remove the AcmeBundle from the registered bundles in `app/AppKernel.php`; |
100 |
| - |
101 |
| - * remove the `web/bundles/acmedemo` directory; |
102 |
| - |
103 |
| - * remove the `security.providers`, `security.firewalls.login` and |
104 |
| - `security.firewalls.secured_area` entries in the `security.yml` file or |
105 |
| - tweak the security configuration to fit your needs. |
106 |
| - |
107 |
| -What's inside? |
108 |
| ---------------- |
109 |
| - |
110 |
| -The Symfony Standard Edition is configured with the following defaults: |
111 |
| - |
112 |
| - * Twig is the only configured template engine; |
113 |
| - |
114 |
| - * Doctrine ORM/DBAL is configured; |
115 |
| - |
116 |
| - * Swiftmailer is configured; |
117 |
| - |
118 |
| - * Annotations for everything are enabled. |
119 |
| - |
120 |
| -It comes pre-configured with the following bundles: |
121 |
| - |
122 |
| - * **FrameworkBundle** - The core Symfony framework bundle |
123 |
| - |
124 |
| - * [**SensioFrameworkExtraBundle**][6] - Adds several enhancements, including |
125 |
| - template and routing annotation capability |
126 |
| - |
127 |
| - * [**DoctrineBundle**][7] - Adds support for the Doctrine ORM |
| 52 | +Il ne manque pas grand-chose avant que votre site ne soit opérationnel. Il faut notamment s'attaquer à la base de données. Pour cela, modifiez le fichier app/config/parameters.yml de votre serveur afin d'adapter les valeurs des paramètres database_*. |
| 53 | +Ensuite connecter a MySQL et importer la base de donner à l'aide du ficher app/Ressources/database.sql |
128 | 54 |
|
129 |
| - * [**TwigBundle**][8] - Adds support for the Twig templating engine |
| 55 | +Ça y est, l'application devrait être opérationnel dès maintenant ! Vérifiez que tout fonctionne bien dans www.votre-serveur.com/app.php. |
| 56 | +Important: |
| 57 | +Les erreurs ne sont certes pas affichées à l'écran, mais elles sont heureusement répertoriées dans le fichier app/logs/prod. Si l'un de vos visiteurs vous rapporte une erreur, c'est dans ce fichier qu'il faut aller regarder pour avoir le détail, les informations nécessaires à la résolution de l'erreur. |
130 | 58 |
|
131 |
| - * [**SecurityBundle**][9] - Adds security by integrating Symfony's security |
132 |
| - component |
| 59 | +============================================================================== |
| 60 | + II : Installation sous Windows |
| 61 | +============================================================================== |
133 | 62 |
|
134 |
| - * [**SwiftmailerBundle**][10] - Adds support for Swiftmailer, a library for |
135 |
| - sending emails |
| 63 | +2) Installation de WAMP |
| 64 | +----------------------- |
136 | 65 |
|
137 |
| - * [**MonologBundle**][11] - Adds support for Monolog, a logging library |
| 66 | +Pour commencer, il faut télécharger l’installeur wamp disponible gratuitement sur son site officiel. (Notez qu’il est disponible en version 32 et 64 bits veillez donc à choisir la bonne version en regard de votre système d’exploitation afin d’en tirer pleinement satisfaction) |
| 67 | +Dès lors que le téléchargement est terminé vous pouvez procéder à son installation. L’installation est très simple je ne m’attarderai pas dessus afin de rester centré uniquement sur l’essentiel dans ce tutoriel. |
138 | 68 |
|
139 |
| - * [**AsseticBundle**][12] - Adds support for Assetic, an asset processing |
140 |
| - library |
141 | 69 |
|
142 |
| - * [**JMSSecurityExtraBundle**][13] - Allows security to be added via |
143 |
| - annotations |
| 70 | +2) Déploiement des différents modules Apache et PHP |
| 71 | +--------------------------------------------------- |
144 | 72 |
|
145 |
| - * [**JMSDiExtraBundle**][14] - Adds more powerful dependency injection |
146 |
| - features |
| 73 | +Pour apache : |
| 74 | +Faites clic-gauche sur l’icône de Wamp dans la barre des tâches > Apache > Apache Modules > sélectionnez « Rewrite Module » |
| 75 | +Pour les modules php : |
| 76 | +clic-gauche sur l’icône de Wamp > PHP > PHP Extensions > cochez « php_intl », « php_xmlrpc », « php_pdo_mysql », « php_sqlite3 », « php_mbstring » |
| 77 | +Symfony2 recommande aussi l’utilisation du module php_apc pour accélérer le rendu des pages. |
147 | 78 |
|
148 |
| - * **WebProfilerBundle** (in dev/test env) - Adds profiling functionality and |
149 |
| - the web debug toolbar |
150 | 79 |
|
151 |
| - * **SensioDistributionBundle** (in dev/test env) - Adds functionality for |
152 |
| - configuring and working with Symfony distributions |
| 80 | +3) Installer wkhtmltopdf |
| 81 | +------------------------ |
153 | 82 |
|
154 |
| - * [**SensioGeneratorBundle**][15] (in dev/test env) - Adds code generation |
155 |
| - capabilities |
| 83 | +Pour télécharger Wkhtmltopdf, rendez-vous à cette adresse : http://wkhtmltopdf.org/downloads.html Dès lors que le téléchargement est terminé vous pouvez procéder à son installation. |
| 84 | +Ensuit vous devez modifier le fichier de configuration app/config/config.yml afin de spécifier le chemin absolue de wkhtmltopdf. |
156 | 85 |
|
157 |
| - * **AcmeDemoBundle** (in dev/test env) - A demo bundle with some example |
158 |
| - code |
159 | 86 |
|
160 |
| -Enjoy! |
| 87 | +4) Test de Symfony2 |
| 88 | +------------------- |
161 | 89 |
|
162 |
| -[1]: http://symfony.com/doc/2.1/book/installation.html |
163 |
| -[2]: http://getcomposer.org/ |
164 |
| -[3]: http://symfony.com/download |
165 |
| -[4]: http://symfony.com/doc/2.1/quick_tour/the_big_picture.html |
166 |
| -[5]: http://symfony.com/doc/2.1/index.html |
167 |
| -[6]: http://symfony.com/doc/2.1/bundles/SensioFrameworkExtraBundle/index.html |
168 |
| -[7]: http://symfony.com/doc/2.1/book/doctrine.html |
169 |
| -[8]: http://symfony.com/doc/2.1/book/templating.html |
170 |
| -[9]: http://symfony.com/doc/2.1/book/security.html |
171 |
| -[10]: http://symfony.com/doc/2.1/cookbook/email.html |
172 |
| -[11]: http://symfony.com/doc/2.1/cookbook/logging/monolog.html |
173 |
| -[12]: http://symfony.com/doc/2.1/cookbook/assetic/asset_management.html |
174 |
| -[13]: http://jmsyst.com/bundles/JMSSecurityExtraBundle/master |
175 |
| -[14]: http://jmsyst.com/bundles/JMSDiExtraBundle/master |
176 |
| -[15]: http://symfony.com/doc/2.1/bundles/SensioGeneratorBundle/index.html |
| 90 | +Placez ensuite le répertoire de l’application dans votre répertoire web (par défaut C:/WAMP/www/ ) et rendez-vous à l’adresse : http://localhost/association/app/check.php |
0 commit comments