Getting Started with Symfony



Symfony is one of the leading PHP Web frameworks. It is Open-Source and built on top of the Symfony Components.

Getting started

Create a Cloud9 workspace of the type “Custom” or “PHP” (if you experience any issues with the install, trying using another workspace type) and install the Intl extension for PHP that is required in most of the Symfony2 projects:

sudo apt-get update
sudo apt-get install php5-intl

Then set a valid PHP timezone:

echo 'date.timezone = UTC' | sudo tee --append /etc/php5/apache2/php.ini

Now start MySQL-Server:

mysql-ctl install
mysql-ctl start

Create a Symfony-Project

Open your Terminal and execute the following to create a new Symfony-Project
You need the first line only if you used the PHP Project type for your workspace.

rm php.ini hello-world.php
composer create-project symfony/framework-standard-edition symfony/ "2.5.*"
mv symfony/{*,.*} ./ 
rm -rf symfony

The create-project composer command will ask for a few parameters, the only one you need to pay special attention is the database-host parameter.

Running the project

There is a IP address checking in the web/app_dev.php file. To disable this check please remove the following lines

		// This check prevents access to debug front controllers that are deployed by accident to production servers.
		// Feel free to remove this, extend it, or make something more sophisticated.
		if (isset($_SERVER['HTTP_CLIENT_IP'])
			|| !in_array(@$_SERVER['REMOTE_ADDR'], array('', 'fe80::1', '::1'))
		) {
			header('HTTP/1.0 403 Forbidden');
			exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');

After that add a new run configuration in Menu Run > Run Configurations > New Run Configuration. Select Apache http (PHP, HTML) as a Runner and web/app_dev.php as Command. That’s it after you hit Run your server will start up and you can access your new Symfony project.

Tutorials - Table of Contents

I really wished this worked, but it doesn’t. I’ve tried countless times with no luck.

  1. sudo apt-get update --> works
  2. sudo apt-get install php5-intl --> already current
  3. echo ‘date.timezone = UTC’ --> works
  4. mysql-ctl install --> works
  5. mysql-ctl start --> works
  6. rm php.ini hello-world.php --> works
  7. composer create-project symfony/framework-standard-edition symfony/ “3.1.*” --> works
  8. mv symfony/{,.} ./ --> works
  9. rm -rf symfony --> works
    10 deleting lines from file --> works
  10. setting up the run command --> works


When I go to actually run it I see:
"Starting Apache httpd, serving"
“Started apache2”

When I click on “Preview --> Preview Running Application” I just get a file listing. When I click on web I get a 404.


Even when I add in “web/addp_dev.php” into the “Command” field of the run box I get the exact same results.


Same here. Are .htaccess files forbidden in


Hola tengo un problema cuando estoy instalando symfony en c9, luego de instalarlo y de quitar la verificación de Ip en config.php y voy a ejecutar
me da el siguiente error:

No sé si es porque tengo una version de php anterior, pero no sé como actualizarla.
¿me podéis ayudar?


May you help me with this error.


Yo tengo el mismo error, ¿Como lo soluciono?


I got symfony project running live, but when I try to look how do website is looking. I can not see the web directory.
Do you know it?


tengo el mismo error y he visto que solo pasa en la versión 3 en adelante


Crear un proyecto de otra versión es así
symfony new asignaciones 2.7
symfony new asignaciones 2.8


When i run I have a 404 (what should i do ?)

do i need to change the permission on the web folder somehow ?


Here is how you can install Symfony successfully:

Follow the official installation documentation here:

sudo mkdir -p /usr/local/bin
sudo curl -LsS -o /usr/local/bin/symfony
sudo chmod a+x /usr/local/bin/symfony

Create a new Symfony project:

symfony new my_project_name

Move content of project directory one level higher and delete that empty directory:

mv my_project_name/* .
rm -rf my_project_name

As Symfony is serving its content from the web directory, we need to modify the apache config using nano (a text editor):

sudo nano /etc/apache2/sites-enabled/001-cloud9.conf

Change the DocumentRoot to the following:

// Change this line
DocumentRoot /home/ubuntu/workspace
// To this
DocumentRoot /home/ubuntu/workspace/web

To save the file, Write Out, Enter, then Close (or press F2, Y, then Enter).

Open web/app.php and toggle your project to production mode:

// Change this line
$kernel = new AppKernel('prod', false);
// To this
$kernel = new AppKernel('prod', true);


Start your Cloud9 server as usual with the green “Run Project” button.

Happy coding!


An alternative method of installing Symfony, if you are installing it on VPS, is through composer. This method is quick and easy.

A simple command would do:

composer create-project symfony/framework-standard-edition your_project_name "3.0.*"

source: Install Symfony 3


I got the same problem, what can i do?


Thank you, thank you, thank you!!


Still worked great for me at 24/10/2017 using symfony 3.3, thanks a lot