官术网_书友最值得收藏!

  • Symfony2 Essentials
  • Wojciech Bancer
  • 321字
  • 2021-07-16 20:06:58

Installing Symfony2 using an installer

To install Symfony2 through an installer, go to the Symfony website at http://symfony.com/download, and install the Symfony2 installer by issuing the following commands:

$ sudo curl -LsS http://symfony.com/installer -o /usr/local/bin/symfony
$ sudo chmod +x /usr/local/bin/symfony

After this, you can install Symfony by just typing the following command:

$ symfony new <new_project_folder>

To install the Symfony2 framework for a to-do application, execute the following command:

$ symfony new todoapp

This command installs the latest Symfony2 stable version on the newly created todoapp folder, creates the Symfony2 application, and prepares some basic structure for you to work with.

After the app creation, you can verify that your local PHP is properly configured for Symfony2 by typing the following command:

$ php app/check.php

If everything goes fine, the script should complete with the following message:

[OK]
Your system is ready to run Symfony projects

Symfony2 is equipped with a standalone server. It makes development easier. If you want to run this, type the following command:

$ php app/console server:run

If everything went alright, you will see a message that your server is working on the IP 127.0.0.1 and port 8000. If there is an error, make sure you are not running anything else that is listening on port 8000. It is also possible to run the server on a different port or IP, if you have such a requirement, by adding the address and port as a parameter, that is:

$ php app/console server:run 127.0.0.1:8080

If everything works, you can now type the following:

http://127.0.0.1:8000/

Now, you will visit Symfony's welcome page.

This page presents you with a nice welcome information and useful documentation link.

Tip

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you have purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files directly e-mailed to you.

主站蜘蛛池模板: 朝阳县| 桑日县| 东丽区| 当涂县| 乐平市| 景宁| 手游| 平凉市| 开江县| 鸡西市| 大兴区| 萍乡市| 布拖县| 蒲城县| 桑日县| 登封市| 分宜县| 竹溪县| 嘉定区| 东乌珠穆沁旗| 无棣县| 双柏县| 鹤山市| 田阳县| 赤城县| 蓬莱市| 定结县| 布尔津县| 黑水县| 宾阳县| 鄯善县| 岑溪市| 西贡区| 铁力市| 泽州县| 茌平县| 大同市| 江门市| 莱阳市| 乳源| 太康县|