Development

Changeset 10064

You must first sign up to be able to contribute.

Changeset 10064

Show
Ignore:
Timestamp:
07/02/08 14:38:19 (5 months ago)
Author:
markchicobaby
Message:

Added some more information for beginners, more explanations around the SVN commands, some references to *nix tools for Windows users, and provided more detail on the Apache virtual host configuration.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • doc/branches/1.0/askeet/en/1.txt

    r8173 r10064  
    2929We'll assume that you use a Unix-like system with Apache, MySQL and PHP 5 installed. If you run a Windows system, don't panic: it will also work fine, you'll just have to type a few commands in the `cmd` prompt. 
    3030 
     31>**Note**: Unix shell commands can come in handy in a Windows environment.  If you would like to use tools like `tar`, `gzip`, or `grep` on Windows you can install [Cygwin](http://cygwin.com/).  The official docs are a little sparse, so a good installation guide can be found [here](http://www.soe.ucsc.edu/~you/notes/cygwin-install.html).  The adventurous may also like to try Microsoft's [Windows Services for Unix](http://technet.microsoft.com/en-gb/interopmigration/bb380242.aspx). 
     32 
    3133Symfony installation 
    3234-------------------- 
     
    4547 
    4648    $ pear install symfony/symfony 
    47  
    48 Check that symfony is installed by using the command line to check the version: 
     49     
     50If a specific version is desired, say 1.0.11, it can be specified as follows: 
     51 
     52    $ pear upgrade symfony/symfony-1.0.11 
     53 
     54Check that symfony is installed by using the command line to check the version (note capital -V): 
    4955 
    5056    $ symfony -V 
     
    6773Wow, that was fast. 
    6874 
    69 >**Note**: Windows users are advised to run symfony and to setup their new project in a path which contains no spaces - this includes the `Documents and Settings` directory
     75>**Note**: Windows users are advised to run symfony and to setup their new project in a path which contains no spaces.  Avoid using the `Documents and Settings` directory, including anywhere under `My Documents` (or `Documents` on Vista)
    7076 
    7177Web service setup 
     
    7884Open the `httpd.conf` file of your `Apache/conf/` directory and add at the end: 
    7985 
    80     <VirtualHost *:80> 
     86    NameVirtualHost 127.0.0.1:80 
     87 
     88    <VirtualHost 127.0.0.1:80> 
    8189      ServerName askeet 
    8290      DocumentRoot "/home/sfprojects/askeet/web" 
     
    8997    </VirtualHost> 
    9098 
    91 >**Note**: the `/sf` alias has to point to the symfony folder in your PEAR data directory. To determine it, just type `pear config-show`. Symfony applications need to have access to this folder to get some image and javascript files, to properly run the web debug toolbar and the AJAX helpers. 
    92  
    93 In Windows, you need to replace the `Alias` line by something like: 
     99>**Note**: The `/sf` alias has to point to the symfony folder in your PEAR data directory. To determine it, just type `pear config-show`. Symfony applications need to have access to this folder to get some image and javascript files, to properly run the web debug toolbar and the AJAX helpers. 
     100 
     101In Windows, you need to replace the `Alias` line with something like: 
    94102 
    95103      Alias /sf "C:\php\pear\data\symfony\web\sf" 
     104 
     105If the above doesn't work, it may be necessary to specify permissions for the aliased `/sf` directory.  The following is from a working Windows [WAMP](http://www.wampserver.com/en/) installation: 
     106 
     107    NameVirtualHost 127.0.0.1:80 
     108 
     109    <VirtualHost 127.0.0.1:80> 
     110      ServerName askeet 
     111      DocumentRoot "C:/sfprojects/askeet/web" 
     112      DirectoryIndex index.php 
     113      Alias /sf "C:/wamp/php/PEAR/data/symfony/web/sf" 
     114      <Directory "C:/sfprojects/askeet/web"> 
     115       AllowOverride All 
     116       Allow from All 
     117      </Directory> 
     118      <Directory "C:/wamp/php/PEAR/data/symfony/web/sf"> 
     119        AllowOverride All 
     120        Allow from All 
     121      </Directory> 
     122    </VirtualHost> 
    96123        
    97124### Declare the domain name 
     
    117144![Congratulations](/images/askeet/congratulations.gif) 
    118145 
    119 >**Note**: symfony can use the `mod_rewrite` module to remove the /index.php/ part of the URLs. 
     146>**Note**: Symfony can use the `mod_rewrite` module to remove the /index.php/ part of the URLs. 
    120147>If you don't want to use it or if your web server does not provide an equivalent facility, you can remove the `.htaccess` file located in the `web/` directory. 
    121148>If your version of Apache is not compiled with `mod_rewrite`, check that you have the mod_rewrite DSO installed and the following lines in your `httpd.conf`: 
     
    134161![web debug toolbar](/images/askeet/web_debug1.gif) 
    135162 
    136 Once again, the setup is a little different if you want to run a IIS server in a Windows environment. Find how to configure it in the [related tutorial](http://www.symfony-project.com/cookbook/1_0/web_server_iis). 
     163>**Note**: If the application works in the development environment (`http://askeet/frontend_dev.php/`), but not the production environment (`http://askeet/`) then check that `mod_rewrite` is configured in `http.conf` as described above, and restart Apache.  It may also be necessary to run `symfony cc` at the command line to clear the symfony cache. 
     164 
     165IIS 
     166--- 
     167 
     168The setup is a little different if you want to run Symfony on an IIS server in a Windows environment. Find how to configure it in the [related tutorial](http://www.symfony-project.com/cookbook/1_0/web_server_iis). 
    137169 
    138170Subversion 
    139171---------- 
    140172 
    141 One of the good principles of lazy folks is not to worry about breaking existing code. As we want to work fast, we want to revert to a previous version if a modification is inefficient, we want to allow more than one person to work on the project, and we also want you to have access to all the daily versions of the application, we are going to adopt source version control. We will use [Subversion][3] for this purpose. Assuming you have already installed a subversion server or have access to a subversion server. 
    142  
    143 Fist, create a new repository for the `askeet` project: 
     173One of the good principles of lazy folks is not to worry about breaking existing code. Source version control allows us to: 
     174 
     175* work fast 
     176* revert to a previous version if a modification is inefficient 
     177* allow more than one person to work on the project 
     178* have access to all the daily versions of the application 
     179 
     180We will use [Subversion][3] for this purpose. We assume you have already installed a subversion server or have access to a subversion server. 
     181 
     182First, create a new repository for the `askeet` project: 
    144183 
    145184    $ svnadmin create $SVNREP_DIR/askeet 
    146185    $ svn mkdir -m "layout creation" file:///$SVNREP_DIR/askeet/trunk file:///$SVNREP_DIR/askeet/tags file:///$SVNREP_DIR/askeet/branches 
     186 
     187>**Note**: For those new to subversion.  These two lines create your subversion repository.  The second line creates the directory structure of the repository.  All the main development code will be versioned in the `trunk` directory.  `tags` holds copies of major code releases such as version 1, version 2, etc.  `branches` is for development code that differs substantially from the main development code.  The usual intention is that `branches` will eventually be merged back into the `trunk`.  For example the main `trunk` development can continue while an unproven new feature is exhaustively tested and fixed in a `branch`.  Once completed the `branch` code is merged back into the `trunk` along with any new changes made since the code branched.  SVN provides powerful tools to assist this process. 
    147188 
    148189Next, you have to do the first import, omitting the `cache/` and `log/` temporary files: 
     
    152193    $ rm -rf log/* 
    153194    $ svn import -m "initial import" . file:///$SVNREP_DIR/askeet/trunk 
    154  
    155 Now get rid of the original application directory and use a checkout of the SVN version: 
     195     
     196>**Note**: For those new to subversion.  The fourth line here imports the askeet files and directories into the SVN `trunk` repository.  The code is now under version control. 
     197 
     198Our code is under version control but the code must be checked out to allow SVN to track changes.  Backup the original application directory and use a checkout of the SVN version for our working copy: 
    156199 
    157200    $ cd /home/sfprojects 
     
    160203    $ ls askeet 
    161204 
     205Once all is OK, delete the original directory we used for import, as its no longer required: 
     206 
    162207    $ rm -rf askeet.origin 
     208 
     209>**Note**: For those new to subversion.  The `trunk` code is now in our working directory `askeet/`.  This is the code that we will modify and develop.  From an SVN perspective it is called our "working copy".  SVN tracks changes to this code when it is committed to the repository. 
    163210 
    164211There is one remaining thing to setup. If you commit your working directory to the repository, you may copy some unwanted files, like the ones located in the `cache` and `log` directories of your project. So you need to specify an ignore list to SVN for this project. 
     
    186233    $ chmod 777 log 
    187234 
    188 >**Note**: Windows users can use the great [TortoiseSVN][4] client to manage their subversion repository. 
     235>**Note**: Windows users can use the great [TortoiseSVN][4] client to manage their subversion repository.  Just remember to never delete directories using the normal Windows Explorer commands.  Instead use Alt-Click Tortoise-Delete (or Rename) so that SVN knows what you intended.  Otherwise you will be unable to commit and will need to instead revert to the last versioned copy of your code using Tortoise-Update. 
    189236 
    190237If you want to know more about source version control, check the [project creation chapter](http://www.symfony-project.com/book/1_0/03-Running-Symfony) in the symfony book. 
     
    213260Make sure you come back tomorrow! 
    214261 
     262---- 
     263 
     264This document last updated:  $LastChangedDate: 2008-03-31 23:32:27 +1100 (Mon, 31 Mar 2008) $ 
     265 
    215266[1]: http://pear.php.net                  "Pear" 
    216267[3]: http://subversion.tigris.org/        "Subversion"