Facebook Twitter Instagram
    TecAdmin
    • Home
    • Ubuntu 20.04
      • Upgrade Ubuntu
      • Install Java
      • Install Node.js
      • Install Docker
      • Install LAMP Stack
    • Tutorials
      • AWS
      • Shell Scripting
      • Docker
      • Git
      • MongoDB
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    Home»PHP Framework»How To Install Symfony 2 Framework on Ubuntu, Debian & LinuxMint

    How To Install Symfony 2 Framework on Ubuntu, Debian & LinuxMint

    RahulBy RahulJanuary 20, 20163 Mins Read

    Symfony is a web application framework written in PHP. Its provides a set of reusable PHP components. Symfony 2.8 is the current stable version available in series of Symfony 2 framework. Symfony is providing 30 stand-alone components for your applications. This tutorial will help you to install Symfony 2 framework on Ubuntu, Debian and LinuxMint operating systems.

    Step 1 – Install Apache & PHP

    First start with the installation of LAMP server on your system. If you have already running LAMP stack skip this step else use followings commands to set up lamp on Ubuntu system.

    Install PHP 5.6

    $ sudo apt-get install python-software-properties
    $ sudo add-apt-repository ppa:ondrej/php
    $ sudo apt-get update
    $ sudo apt-get install -y php5.6 php5.6-intl
    

    Install Apache2

    $ apt-get install apache2 libapache2-mod-php5
    

    Step 2 – Setup Symfony Installer

    Symfony provides its own installer for creating new projects. Below commands will help you to setup Symfony installer on your system.

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

    Step 3 – Create New Symfony 2 Application

    After successful setup of Symfony installer on your system. Let’s start with your new Symfony application. Navigate to your web document root and create a new Symfony application.

    $ cd /var/www
    $ symfony new myproj 2.8
    

    Now change to newly created directory and check if all requirements are properly installed on your system. If everything is fine you will get following results.

    $ php myproj/bin/symfony_requirements
    
    
     [OK]
     Your system is ready to run Symfony2 projects
    

    Step 4 – Start Application in Development Mode

    Now start development with Symfony 2 php framework and built great application’s. To view changes in browser you can start Symfony developer web server using following command. By default web server will start on port 8000.

    $ php bin/console server:run
    
    
     [OK] Server running on http://127.0.0.1:8000
     // Quit the server with CONTROL-C.
    

    Now access new Symfony 2 application in your browser by accessing http://127.0.0.1:8000 or http://localhost:8000 .

    Install Symfony 2 Framework

    Step 5 – Create Apache VirtualHost

    Now If you need to configure Symfony 2 with sub domain. Create a new Apache configuration file under directory /etc/apache2/sites-available/ and add Virtual Host for your Symfony 2 application.

    $ vim /etc/apache2/sites-available/symphony2.example.com.conf
    

    directory and add below content.

    <VirtualHost *:80>
        ServerName symphony2.example.com
        DocumentRoot /var/www/myproj/web
    
        <Directory /var/www/myproj/web>
            AllowOverride All
            Order Allow,Deny
            Allow from All
            <IfModule mod_rewrite.c>
                Options -MultiViews
                RewriteEngine On
                RewriteCond %{REQUEST_FILENAME} !-f
                RewriteRule ^(.*)$ app.php [QSA,L]
            </IfModule>
        </Directory>
    
        ErrorLog /var/log/apache2/myproj_error.log
        CustomLog /var/log/apache2/myproj_access.log combined
    </VirtualHost>
    
    

    Finally enable website and reload Apache service using below command.

    $ sudo a2ensite symphony2.example.com
    $ sudo service apache2 reload
    

    Now access new Symfony 2 application in your browser with your domain name like http://symfony2.example.com. Change symfony2.example.com with your domain name.

    Install Symfony 2 Framework with Apache

    Click here to read more about Symfony framework.

    php framework Symfony Symfony 2
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp
    Previous ArticleHow To Install Symfony 3 Framework on Ubuntu, Debian & LinuxMint
    Next Article Kali Linux 2022.2 – The Second 2022 Kali Rolling Release

    Related Posts

    How To Set Up Laravel on Ubuntu 21.04 & 20.10

    Updated:July 15, 20214 Mins Read

    How to Enable Debug Mode in Laravel

    Updated:May 28, 20211 Min Read

    How to Remove Package from Laravel (Composer)

    Updated:July 15, 20211 Min Read

    How to Install Laravel 9 on CentOS 8

    Updated:February 16, 20224 Mins Read

    How to Install CodeIgniter on Ubuntu 20.04

    Updated:August 11, 20214 Mins Read

    How to Install Laravel on Ubuntu 20.04

    Updated:June 7, 20214 Mins Read

    Leave A Reply Cancel Reply

    Recent Posts
    • What is CPU? – Definition, Types and Parts
    • What is the /etc/aliases file
    • What is the /etc/nsswitch.conf file in Linux
    • How to Install Ionic Framework on Ubuntu 22.04
    • What is the /etc/hosts file in Linux
    Facebook Twitter Instagram Pinterest
    © 2022 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.