symfony on wamp - pret pour l'utilisation d'eclipse PDT avec plugins sfDT

Ce petit tuto vise à documenter l'installation d'un environnement de développement complet et fonctionnel pour symfony sous windows

installation de wamp

télécharger sur le site officiel de http://www.wampserver.com/, les choix par défaut sont parfaits pour installer un serveur de développement

installation de pear


démarrer > exécuter > C:\wamp\bin\php\php5.2.8\go-pear.bat
executer.gif

Are you installing a system-wide PEAR or a local copy?
(system|local) [system] :
taper entrée (choix par défaut [system])

les options suivantes sont proposées (les path d'adapter avec la version de php installées):
 1. Installation base ($prefix)                   : C:\wamp\bin\php\php5.2.8
 2. Temporary directory for processing            : C:\wamp\bin\php\php5.2.8\tmp
 3. Temporary directory for downloads             : C:\wamp\bin\php\php5.2.8\tmp
 4. Binaries directory                            : C:\wamp\bin\php\php5.2.8
 5. PHP code directory ($php_dir)                 : C:\wamp\bin\php\php5.2.8\pear
 6. Documentation directory                       : C:\wamp\bin\php\php5.2.8\docs
 7. Data directory                                : C:\wamp\bin\php\php5.2.8\data
 8. User-modifiable configuration files directory : C:\wamp\bin\php\php5.2.8\cfg
 9. Public Web Files directory                    : C:\wamp\bin\php\php5.2.8\www
10. Tests directory                               : C:\wamp\bin\php\php5.2.8\tests
11. Name of configuration file                    : C:\Windows\pear.ini
12. Path to CLI php.exe                           : C:\wamp\bin\php\php5.2.8\.

il faut les modifier comme suit
 1. Installation base ($prefix)                    : C:\wamp\bin\php\php5.2.8
 2. Temporary directory for processing             : C:\wamp\bin\php\php5.2.8\tmp
 3. Temporary directory for downloads              : C:\wamp\bin\php\php5.2.8\tmp
 4. Binaries directory                             : C:\wamp\bin\php\php5.2.8
 5. PHP code directory ($php_dir)                  : C:\wamp\bin\php\php5.2.8\pear
 6. Documentation directory                        : C:\wamp\bin\php\php5.2.8\pear\docs
 7. Data directory                                 : C:\wamp\bin\php\php5.2.8\pear\data
 8. User-modifiable configuration files directory  : C:\wamp\bin\php\php5.2.8\pear\cfg
 9. Public Web Files directory                     : C:\wamp\www
10. Tests directory                                : C:\wamp\bin\php\php5.2.8\pear\tests
11. Name of configuration file                     : C:\wamp\bin\php\php5.2.8\pear.ini
12. Path to CLI php.exe                            : C:\wamp\bin\php\php5.2.8\.

les path 6, 7, 8, 9, 10, 11 sont à changer

Would you like to alter php.ini C:\wamp\bin\php\php5.2.8\php.ini? [Y/n] :
taper entrée (choix par défaut [Yes])

Current include path           : .;C:\php5\pear
Configured directory           : C:\wamp\bin\php\php5.2.8\pear
Currently used php.ini (guess) : C:\wamp\bin\php\php5.2.8\php.ini
Press Enter to continue:
taper entrée
* WINDOWS ENVIRONMENT VARIABLES *
For convenience, a REG file is available under C:\wamp\bin\php\php5.2.8\PEAR_ENV.reg .
This file creates ENV variables for the current user.
Double-click this file to add it to the current user registry.
Appuyez sur une touche pour continuer...
taper entrée

mide à jour des variables d'environnement

éditer C:\wamp\bin\php\php5.2.8\PEAR_ENV.reg, si la configuration a été correctement effectuée le fichier doit contenir
REGEDIT4
[HKEY_CURRENT_USER\Environment]
"PHP_PEAR_SYSCONF_DIR"="C:\\wamp\\bin\\php\\php5.2.8"
"PHP_PEAR_INSTALL_DIR"="C:\\wamp\\bin\\php\\php5.2.8\\pear"
"PHP_PEAR_DOC_DIR"="C:\\wamp\\bin\\php\\php5.2.8\\PEAR\\docs"
"PHP_PEAR_BIN_DIR"="C:\\wamp\\bin\\php\\php5.2.8"
"PHP_PEAR_DATA_DIR"="C:\\wamp\\bin\\php\\php5.2.8\\PEAR\\data"
"PHP_PEAR_PHP_BIN"="C:\\wamp\\bin\\php\\php5.2.8\\.\\php.exe"
"PHP_PEAR_TEST_DIR"="C:\\wamp\\bin\\php\\php5.2.8\\PEAR\\tests"
un double clique sur ce fichier pour importer les clés de registre PEAR dans l'environnement de l'utilisateur

Il faut maintenant ajouter le path de php.exe, ainsi que le path des commandes mysql.

Pour se faire panneau de configuration > système > paramètres système avancés > variables d'environnement

prop_systeme.gif

Dans la sous fenêtre variables système dérouler l'ascensceur jusqu'à trouver la variable Path

var_env.gif

Sélectionner cette variable puis cliquer sur modifier
Dans le champs Valeur de la variable positionner le curseur à la fin de la chaîne de caractère existante.
Ajouter ;C:\wamp\bin\php\php5.2.8;C:\wamp\bin\mysql\mysql5.1.30\bin

var_systeme.gif

A ce stade là il faut se déconnecter et se reconnecter pour force la relecture des variables d'environnement qui viennent d'être ajoutées

installation de symfony (rendez-vous sur http://www.symfony-project.org/ pour choisir la version à installer)
pear upgrade PEAR
pear channel-discover pear.symfony-project.com
pear install symfony/symfony-1.0.19
symfony -V
la dernière commande permet de tester la verison de symfony qui vient d'être installée

paramètrage d'apache

pour avoir accès aux fichiers utiles du framework symfony il faut configurer un alias vers le répertoire web de l'installation de pear.
Pour se faire il suffit d'ajouter un fichier sf.conf dans le répertoire c:\wamp\alias\ qui contient les directives apache suivantes:

Alias /sf "c:/wamp/bin/php/php5.2.8/PEAR/data/symfony/web/sf"

<Directory "c:/wamp/bin/php/php5.2.8/PEAR/data/symfony/web/sf">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride all
        Order Deny,Allow
    Deny from all
    Allow from 127.0.0.1
</Directory>
création d'un virtual host dans apache.
Dans C:\wamp\bin\apache\Apache2.2.11\conf\httpd.conf ajouter après la ligne Include "c:/wamp/alias/*" à la fin du fichier

NameVirtualHost *:80

<VirtualHost *:80>
   ServerName localhost
   DocumentRoot "c:/wamp/www/"
   DirectoryIndex index.php
</VirtualHost>

<VirtualHost *:80>
   ServerName mysite
   DocumentRoot "c:/wamp/www/mysite/web"
   DirectoryIndex index.php
  <Directory "c:/wamp/www/mysite/web">
       AllowOverride All
   </Directory>
</VirtualHost>

redémarrer apache pour appliquer les modifications comme suit
cliquer sur l'icône wamp dans la barre systray > restart all service
image_menu_wamp.gif

rendre le vhost accessible en local


editer le fichier C:\Windows\System32\drivers\etc et ajouter à la fin du fichier
 127.0.0.1       mysite

création d'un projet symfony

créer un répertoire c:\wamp\www\mysite
ouvrir une fenêtre de commande ms dos et sur positionner sur c:\wamp\www\mysite
pour créer un projet taper: symfony init-project mysite
pour créer une première application: symfony init-app front

ouvrir un navigateur et taper mysite dans la barre d'url la page de création de projet symfony doit s'afficher

finaliser l'installation

pour convertir correctement le schema.yml de symfony il faudra activer le module php xsl pour php cli
editer c:\wamp\bin\php\php5.2.8\php.ini décommenter (enlever le ; devant) la ligne
extension=php_xsl.dll

pour profiter pleinement du routing system de symfony il faut activer mod_rewrite dans apache
editer C:\wamp\bin\apache\Apache2.2.11\conf\httpd.conf décommenter (enlever le # devant) la ligne
LoadModule rewrite_module modules/mod_rewrite.so

Si d'aventure toutes les balises ouvrantes php ne sont pas de la forme <?php modifier short_open_tag = Off à On c:\wamp\bin\apache\apache2.2.11\bin\php.ini

installation supplémentaire

installer le pake de compatibilité i18n DBdesigner
coller le pake http://trac.symfony-project.org/attachment/wiki/HowToPatchTablesForI18nFromGeneratedSchema/sfPakePatchDbI18n.php?format=raw
dans C:\wamp\bin\php\php5.2.8\PEAR\data\symfony\tasks

configuration d'eclipse

installation d'eclipse PDT 1.3 http://download.eclipse.org/tools/pdt/downloads/index-old.php
installer la dernière version de java http://www.java.com/fr/download/ une version trop vieille empêchera PDT de fontcionner correctement
installer le plugin sfDT
Dans le menu Eclipse sélectionner select Help -> Software Updates -> Find and Install...
cliquer sur "Search for new features to install" et cliqur sur "next"
dans la fenêtre qui apparaît vliquer sur "New Remote Site" ...
Dans la boîte de dialoque entrer sfDT comme name et http://sfdt.borox.ch/updates pour l'url
cliquer sur "finish" suivre les instructions et répondre oui à toutes les questions
installation du plugin clay azzuri modeling
http://www.azzurri.jp/en/clay/quick_start_guide.html
file > new > project > symfony > sfProject puis "next"
lien "configure installation"
add > C:\wamp\bin\php\php5.2.8\PEAR
http://www.azzurri.jp/eclipse/en/index.html
installer le plugin subclipse
http://subclipse.tigris.org/servlets/ProjectProcess?pageID=p4wYuA
décocher subclipse intergations
config tortoise svn et putty
http://www.woodwardweb.com/java/howto_configure.html