Installing and Configuring Symfony2 on Windows: Difference between revisions
| (23 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
[[Category:Symfony]] [[Category:MVC]] [[Category:CMS]] [[Category:PHP]] [[Category:Web Development]] [[Category:Windows]] | |||
== Overview == | == Overview == | ||
Notes and instructions on installing Symfony2 on Windows, including notes and instructions on setting up a new project. | Notes and instructions on installing Symfony2 on Windows, including notes and instructions on setting up a new project. | ||
== Prerequisites == | == Prerequisites<ref>[http://symfony.com/doc/current/reference/requirements.html Requirements for Running Symfony2], Symfony</ref> == | ||
* [http://getcomposer.org Composer], a dependency management library for PHP | |||
** Can be installed anywhere on the local computer.<ref>[https://getcomposer.org/download/ Download Composer]</ref> `> curl -sS https://getcomposer.org/installer | php` | |||
** `littledamienii`: `c:/Composer` | |||
** Using Composer: `> php composer.phar` | |||
''(Composer can also be configured to run by simply entering a `composer` command. See [[Executing .phar Files on Windows]])'' | |||
== Creating a new project<ref>[http://symfony.com/doc/current/book/installation.html Installing and Configuring Symfony], Symfony Documentation</ref> == | |||
=== Download Symfony distribution === | |||
<pre>> php composer.phar create-project symfony/framework-standard-edition /path/to/webroot/Symfony/ 2.3.4</pre> | |||
* `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. | |||
** `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. Leave this off to install the most recent version. | |||
=== 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. | |||
=== Confirming the version === | |||
<syntaxhighlight lang="bash"> | |||
$ php app/console --version | |||
</syntaxhighlight> | |||
=== Dev environment === | |||
Simply visiting the site will load the production environment (`web/app.php`). | |||
To load the development environment, load the site using `<nowiki>http://[siteurl.com]/app_dev.php[/path/to/page/]</nowiki>`. | |||
== Upgrading == | |||
Starting with Symfony 2.3, from the project root:<ref>[http://symfony.com/blog/upgrading-your-symfony-projects-the-easy-way Upgrading Your Symfony Projects], Symfony documentation</ref> | |||
<syntaxhighlight lang="bash"> | |||
$ composer update | |||
</syntaxhighlight> | |||
This will update Symfony to the latest point release. To update to the latest version if it's a different minor version, first update the `require.symfony/symfony` version in `composer.json` in the project's root directory. Then run `composer update`. | |||
''N.B. composer itself can be updated if necessary with `composer self-update`.'' | |||
== See also == | == See also == | ||
=== External links === | |||
* [http://www.kevwebdev.com/blog/installing-php-5-dot-4-on-windows-7-for-developing-with-symfony2.html Kev Web Dev: Installing PHP 5.4 on Windows 7 for Developing With Symfony2] | * [http://www.kevwebdev.com/blog/installing-php-5-dot-4-on-windows-7-for-developing-with-symfony2.html Kev Web Dev: Installing PHP 5.4 on Windows 7 for Developing With Symfony2] | ||
=== Notes === | |||
<references /> | |||
Latest revision as of 18:15, 3 March 2015
Overview[edit]
Notes and instructions on installing Symfony2 on Windows, including notes and instructions on setting up a new project.
Prerequisites[1][edit]
- Composer, a dependency management library for PHP
- Can be installed anywhere on the local computer.[2]
> curl -sS https://getcomposer.org/installer | php littledamienii:c:/Composer- Using Composer:
> php composer.phar
- Can be installed anywhere on the local computer.[2]
(Composer can also be configured to run by simply entering a composer command. See Executing .phar Files on Windows)
Creating a new project[3][edit]
Download Symfony distribution[edit]
> 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.pharcannot be located usephp 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
webis installed belowSymfony/ornewproject/. 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.4The version of Symfony to install. Leave this off to install the most recent version.
Create a new site in IIS[edit]
- The root directory of the site is
[drive]:[\base\path\]newproject\web\
Test the new installation[edit]
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, editweb/app_dev.phpto 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.
Confirming the version[edit]
$ php app/console --version
Dev environment[edit]
Simply visiting the site will load the production environment (web/app.php).
To load the development environment, load the site using `http://[siteurl.com]/app_dev.php[/path/to/page/]`.
Upgrading[edit]
Starting with Symfony 2.3, from the project root:[4]
$ composer update
This will update Symfony to the latest point release. To update to the latest version if it's a different minor version, first update the require.symfony/symfony version in composer.json in the project's root directory. Then run composer update.
N.B. composer itself can be updated if necessary with composer self-update.
See also[edit]
External links[edit]
Notes[edit]
- ↑ Requirements for Running Symfony2, Symfony
- ↑ Download Composer
- ↑ Installing and Configuring Symfony, Symfony Documentation
- ↑ Upgrading Your Symfony Projects, Symfony documentation