Installing and Configuring Symfony2 on Windows: Difference between revisions

From Littledamien Wiki
Jump to navigation Jump to search
Line 16: Line 16:
See [http://symfony.com/doc/current/book/installation.html Symfony Documentation: Installing and Configuring Symfony]
See [http://symfony.com/doc/current/book/installation.html Symfony Documentation: Installing and Configuring Symfony]


* Download Symfony distribution: <pre>> php composer.phar create-project symfony/framework-standard-edition /path/to/webroot/Symfony/ 2.3.4</pre>
=== Download Symfony distribution ===
** `php composer.phar`  
<pre>> php composer.phar create-project symfony/framework-standard-edition /path/to/webroot/Symfony/ 2.3.4</pre>
*** Use Composer to download and install.
* `php composer.phar`  
*** If `composer.phar` cannot be located use `php c:\Composer\composer.phar`
** Use Composer to download and install.
** `create-project` "Create project" parameter.
** If `composer.phar` cannot be located use `php c:\Composer\composer.phar`
** `symfony/framework-standard-edition`  
* `create-project` "Create project" parameter.
*** Symfony distribution to install.
* `symfony/framework-standard-edition`  
*** ''TODO: Investigate options and determine best one. Esp. standard distribution vs. distribution without vendors.''
** Symfony distribution to install.
** `/path/to/webroot/Symfony/`  
** ''TODO: Investigate options and determine best one. Esp. standard distribution vs. distribution without vendors.''
*** Location of the Symfony project.  
* `/path/to/webroot/Symfony/`  
*** E.g. `./develop/littledamien/newproject/`
** Location of the Symfony project.  
*** ''TODO: A directory named `web` is installed below `Symfony/` or `newproject/`. This is where requests are routed. All other files and directories should be non-public. Figure out the best naming convention for the project root directory, and where on the staging and production servers it should be located relative to public directories. ''
** E.g. `./develop/littledamien/newproject/`
** `2.3.4` The version of Symfony to install.
** ''TODO: A directory named `web` is installed below `Symfony/` or `newproject/`. This is where requests are routed. All other files and directories should be non-public. Figure out the best naming convention for the project root directory, and where on the staging and production servers it should be located relative to public directories. ''
* Create a new site in IIS.
* `2.3.4` The version of Symfony to install.
** The root directory of the site is `[drive]:[\base\path\]newproject\web\`
 
* Test the new installation.
=== Create a new site in IIS ===
** `http://newproject.dbarchowsky.com/config.php`
 
*** This will list recommendations to create an optimal environment for Symfony.
* The root directory of the site is `[drive]:[\base\path\]newproject\web\`
*** It's necessary to add the static IP of the gateway to the list of allowed IP address in `web/config.php`.
 
** If not connecting to the site using `http://localhost`, edit `web/app_dev.php` to add the remote address to the list of allowed addresses.  
=== Test the new installation ===
** In a browser go to `http://newproject.dbarchowsky.com/app_dev.php`.
 
** A welcome page should load. If it does, the site is ready for development.  
* `http://newproject.dbarchowsky.com/config.php`
** See also, removing sample scripts from the distribution.
** This will list recommendations to create an optimal environment for Symfony.
** It's necessary to add the static IP of the gateway to the list of allowed IP address in `web/config.php`.
* If not connecting to the site using `http://localhost`, edit `web/app_dev.php` to add the remote address to the list of allowed addresses.  
* In a browser go to `http://newproject.dbarchowsky.com/app_dev.php`.
* A welcome page should load. If it does, the site is ready for development.  
* See also, removing sample scripts from the distribution.


=== Dev environment ===
=== Dev environment ===

Revision as of 14:28, 19 March 2014

Overview

Notes and instructions on installing Symfony2 on Windows, including notes and instructions on setting up a new project.

Prerequisites

See Symfony: Requirements for Running Symfony2

  • Composer, a dependency management library for PHP
    • Can be installed anywhere on the local computer.
    • littledamienii: c:/Composer
    • Using Composer:
      > php composer.phar

Creating a new project

See Symfony Documentation: Installing and Configuring Symfony

Download Symfony distribution

> php composer.phar create-project symfony/framework-standard-edition /path/to/webroot/Symfony/ 2.3.4
  • php composer.phar
    • Use Composer to download and install.
    • If composer.phar cannot be located use php c:\Composer\composer.phar
  • create-project "Create project" parameter.
  • symfony/framework-standard-edition
    • Symfony distribution to install.
    • TODO: Investigate options and determine best one. Esp. standard distribution vs. distribution without vendors.
  • /path/to/webroot/Symfony/
    • Location of the Symfony project.
    • E.g. ./develop/littledamien/newproject/
    • TODO: A directory named web is installed below Symfony/ or newproject/. This is where requests are routed. All other files and directories should be non-public. Figure out the best naming convention for the project root directory, and where on the staging and production servers it should be located relative to public directories.
  • 2.3.4 The version of Symfony to install.

Create a new site in IIS

  • The root directory of the site is [drive]:[\base\path\]newproject\web\

Test the new installation

  • http://newproject.dbarchowsky.com/config.php
    • This will list recommendations to create an optimal environment for Symfony.
    • It's necessary to add the static IP of the gateway to the list of allowed IP address in web/config.php.
  • If not connecting to the site using http://localhost, edit web/app_dev.php to add the remote address to the list of allowed addresses.
  • In a browser go to http://newproject.dbarchowsky.com/app_dev.php.
  • A welcome page should load. If it does, the site is ready for development.
  • See also, removing sample scripts from the distribution.

Dev environment

TODO: research and document loading the dev environment vs. the production environment.

For example, there are two "app" files: web/app.php and web/app_dev.php. The demo script isn't accessible when using app.php.

What is the recommended method for switching between the two? I hacked the .htaccess file to replace all instances of app.php with app_dev.php and this allowed the demo to be loaded, whereas before it was generating a 404 error. But this can't be the right way of doing it.

See also