Symfony installation use, Symfony2 installation _php tutorial

Source: Internet
Author: User
Tags php language drupal

Symfony installation use, SYMFONY2 installation


Symfony is a powerful framework with DI features, and currently the most popular PHP development framework drupal,laravel The bottom-up is the use of symfony. To learn more about Symfony, portal

Installation Symfony is very simple, generally there are 2 ways, we randomly choose

I. Direct installation using Symfony installer (recommended)

Depending on the operating system, the installation is slightly different

1.linux/mac OS

Execute the following command on the console:

sudo curl-lss http://symfony.com/installer-o/usr/local/bin/symfonysudo  chmod A+x/usr/local/bin/symfony

A global command will be created on your operating system Symfony

2.Windows (can be skipped)

Execute the following command on the console:

" ReadFile (' Http://symfony.com/installer '); " > Symfony

Move the downloaded Symfony file to your project directory, and then execute the following command:

c:\> Move symfony c:\projectsc:\projects\> PHP symfony

3. Create a Symfony app

Create the first Symfony app with the new command

# Linux, Mac OS x$ symfony new my_project_name# windowsc:\> CD projects/c:\projects\> PHP symfony New My_project_name

Two. Install symfony using composer

If your PHP version is less than 5.4, the first way is not for you, you can consider upgrading PHP version, continue to use the first, you can also consider the use of composer to install.

What is composer?

If you are familiar with the Java Maven,ruby gem,python Pip,nodejs NPM, you will of course be at a glance.

Yes, composer is a dependency management tool tailored to the PHP language. Want to get a quick look at composer, portal

1. Installing composer

Composer requires php5.3.2+ to run

Linux/mac

$ curl-ss https://Getcomposer.org/installer | php

It is recommended to execute the following command again

MV Composer.phar/usr/local/bin/composer

This composer becomes the global command, where you can execute the input composer

Windows

Quick and automatic installation

Download and run the Composer-setup.exe program, next step, you understand. Finally, don't forget to set path

2. Create a Symfony app using the Create-project command

$ composer Create-project Symfony/framework-standard-edition My_project_name

If you want to specify the installation Symfony version, add a parameter at the end of the command

e.g

" 2.3.* "

All right

Symfony successfully installed.

Let's visit the Welcome page!

Symfony has an internal test server that can start the server by executing the following command

$ cd my_project_name/$ php app/console server:run

After the server is started, enter localhost:8000 in the address bar and you will be able to see the Welcome to Symfony interface.

Finally you want to stop the server, so long as this is good.

$ php app/console server:stop

Possible problems:

If you are prompted for errors when you execute PHP app/console server:run

You just need to go to the app folder below to find the appkernel.php file and add a method to the file at the end:

    publicfunction  init ()    {        ' europe/paris ' );        Parent::init ();    }

Once saved, restart the server (PHP app/console server:run) and you're done.

http://www.bkjia.com/PHPjc/1063521.html www.bkjia.com true http://www.bkjia.com/PHPjc/1063521.html techarticle symfony installation use, Symfony2 installation Symfony is a powerful framework with DI characteristics, the current popular PHP development Framework drupal,laravel The bottom of the use of symfony. Want to know about s ...

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.