March 15, 2013 Symfony Logo

Symfony2 – How to install

Symfony2 – How to install

So I came across this job listing for a Symfony PHP Web developer. That opened up my curiosity about this framework and started searching online for any tutorials or any instructions or how to’s etc. I finally came across a good video on youtube in which it explains the basic and so I tried it out.

For starters, most of the people that read this blog are CodeIgniter oriented. If you already know about CodeIgniter, then this installation process you can say is basically almost the same. We all know that in CodeIgniter, we would need to change some parameters in the config.php file, and in the routes.php file etc. If your not familiar with any PHP Framework, and would like to get started with Symfony2, then here we go!

First Step

And the most obvious step of all is, we need to download the framework. This framework can be found in the following link: Download Symfony.
[ideabox]Before doing anything else, make sure that your Apache server, and your MySQL are running. [/ideabox]

After downloading the file that corresponds to you, extract the content, “which is a folder called Symfony”, and place that inside your htdocs folder.

Basic Configuration

Once the content has been extracted into your htdocs folder, you can name it whatever you want. In this case, I left mine with the name of symfony. That way, when I want to access it, it will make a lot more sense to request the ‘symfony’ directory rather than naming it something irrelevant, and of course, makes it easier on you while learning something new.

In order to configure a few files, which would be parameters.yml, and config.yml files in your symfony framework, you should access the page named config.php. This can be accessed in the following path:

[emptybox]http://your-localhost-address/symfony/web/config.php[/emptybox]

When accessing this page, you will see a BIG! welcome. This page will give you some recommendations according to your PHP and MySQL installation. At the bottom, you will see 3 links. Thiese links are for the following:

Go to the next step to configure your database parameters
Bypass this configuration process
Or make symfony recheck your server for best recommendations.

Enable INTL

One of the recommendations you might find in the list might be to enable INTL. This is used for some validations that we will be looking at later on, on future tutorials. To do this, travel to your php directory, and find the php.ini file. This file can be found here:

[emptybox]path-to-your-xampp-folder\php\php.ini[/emptybox]

Once you find it, open it up with notepad. Do a quick search on ‘intl’. Once you find it, you will see it has a semi-colon ( ; ) in front of it’s sentence. You can delete that semi-colon, and the save the file. Restart your apache server so that the change can take effect.

Now that you have the INTL enabled, you can go ahead and click on the next steps link below. The first of 2 steps that you will see will be to configure your database parameters. Here you specify what type of database you want to use, either PDO, SQLite etc. Here you will also write down the username and password for your database, and also, the database name.

Once finished setting up the database connection, click on next step to enter step 2. This step will have symfony auto generate a secret key for you. For now, we can leave this key as is and click next.

When you enter the next page, you will see a “Well Done” message. This step tells you the files that were modified in your symfony framework. Now, you can go ahead and click on the bottom link, to the Welcome Page.

In the welcome page you will find a few links to documentation, demos and tours etc. These will help us through our journey in learning this new framework. For now, to see how this works, we can click on ‘Run The Demo’ Link all the way on the right. This will bring up a page with 3 demos. Go ahead and play around with these links, and see how the url changes. If you notice, you will see that url is similar to that of CodeIgniter(if you are familiar with CI), in which, you will have the method name, and variable on the page url.

This would be all for now to learn symfony2 how to install, and hopefully begin creating awsome apps with it. Hope everyone enjoys!

Tagged on:

Leave a Reply

Your email address will not be published. Required fields are marked *

The qTranslate Editor has disabled itself because it hasn't been tested with your Wordpress version yet. This is done to prevent Wordpress from malfunctioning. You can reenable it by clicking here (may cause data loss! Use at own risk!). To remove this message permanently, please update qTranslate to the corresponding version.