Installing Symfony on WAMP

This post will help guide you through the process of installing Symfony with WAMP.

  1. If you do not have WAMP already installed head over to the the WAMP website and download the latest installer.
    WAMP Install
  2. Once installed enable the apache rewrite_module by clicking on the WAMP icon in your task bar, navigating to the Apache > Apache Modules directory and  clicking on the rewrite_module.Enabling Apache Rewrite Module - WAMP
  3. Next you will need to enable the php_xsl.dll extension in the php.ini configuration file. To do this click on the WAMP icon in your task bar again, select the PHP folder and click on php.ini. Navigate to the php_xsl.dll extension and remove the semicolon from the line.
    Enabling php_xsl.dll
  4. Save the file, click on the WAMP icon in the task bar and click “Restart All Services”
  • Adding PHP and MySQL as Windows Environment Variables

  • The next step is to add PHP and MySQL to your windows environment variables. You will first have to note down the full path to your PHP and MySQL folders. To do this navigate to your WAMP base directory (My was installed in G:wamp).
  1. Navigate to wamp/www/bin/php/phpversion folder.
  2. Copy this path to a notepad document, you will need it after the next step.
  3. Do the same for your mysql directory including the mysql bin directory. For reference the complete paths to my folders were G:wampbinphpphp5.4.3 and G:wampbinmysqlmysql5.5.24bin
  4. Copy both paths to a single line with a semicolon placed before each path like so ;G:wampbinphpphp5.4.3;G:wampbinmysqlmysql5.5.24bin
  5. Go to your windows control panel, click on the system icon, click on advanced system settings found in the left pane. A new window will appear. Click on the Environment Variables button under the Advanced tab. Below User Variables your should see your System Variables. Scroll down in this section until you see the Path Variable  Path, click to Edit this variable.
  6. Finally, add the ;G:wampbinphpphp5.4.3;G:wampbinmysqlmysql5.5.24bin string to the end of the string found in the Variable value input box.
    Adding Windows Environment Variables
  • To test that this is now working you will need to open the command prompt. Click on the start button > type cmd into the search box > right-click cmd.exe and open as administrator (you will need to run as administrator in later steps).
  • Type php into the command line. If nothing happens then you are all set and can close the window for now. However, if the message “‘php’ is not recognized as an internal or external command, operable program or batch file” then your system variable did not take. I would recommend moving the PHP and MySQL paths to the front of the Variable value list, which is what I have done in the example above. You will not need the semicolon before the PHP folder location, instead you will need to add a semicolon after the mysql path so that you are separating this from the other system paths listed. Ensure that the path has no spaces and all paths are correctly separated by a semicolon. Close the window and try opening the command prompt again and type PHP.

If everything went according to plan you should not be able to move to the next steps.

Installing Pear

In this next step you will need to install Pear.

  1. Start by saving the following file to your wamp/bin/php/phpversion directory http://pear.php.net/go-pear.phar
  2. Install PEAR go to your command prompt (open as administrator) cd into the wamp > bin > php > php version
  3. Type php go-pear.phar
  4. Type in system and hit return to install a system-wide copy
  5. At the next prompt asking for 1-12, ‘all or Enter simply hit the Enter key.
  6. If prompted with a warning to edit php.ini type Y and hit return.

Installing Pear on WAMP

Installing Symfony

You are now able to install symfony and create your first symfony project  from the command prompt by following these steps:

  1. pear channel-discover pear.symfony-project.com
  2. next type in pear install symfony/symfony. This file can take a minute or two as it will need to download the file and install symfony.
  3. Once symfony is installed we will create a new folder under your wamp/www directory called symfony_application. You can do this in  command prompt: cd into the wamp/www directory and type mkdir symfony_application
  4. cd into symfony_application and type  symfony generate:project symfony_application. If you receive the error: ‘symfony’ is not recognized as an internal or external command, operable program or batch file then please read the steps for adding PHP and MySQL as windows environment variables above.creating_symfony_application_1
  5.  Type in symfony generate:app symfony_application
    creating_symfony_application_2
  6. Open up your favorite browser, type in localhost/symfony_facebookgroup/web. If all went well then you should see a white pagecreating_symfony_application_3
  7. Navigate to wamp/bin/php/phpversion/data/symfony/web and copy the “sf” folder.
  8. Navigate to wamp/www/syfony_application/web and paste this folder into this location.
  9. Go to your browser and refresh localhost/symfony_application/web and you should now have all of the assets needed for your symfony project folder.creating_symfony_application_4

Final Notes

If everything went to plan you should now have a symfony project folder setup under your www directory. You can repeat steps 3 through 9 above to create new projects with your own folder name. When you navigate to your localhost you should be able to see these projects listed.

If you have had any problems during the tutorial and have it a stumbling block then please let me know in the comments below and I will try to help you as best I can.

10 Comments on “Installing Symfony on WAMP”

  1. Pingback: symfony installation and staring project - BlogoSfera

  2. Hello, I have followed your tuto, but during the pear step, i have this message on my cmd : D:\wamp\bin\php\php5.5.12>php go-pear.phar
    ´╗┐manifest cannot be larger than 100 MB in phar “D:\wamp\bin\php\php5.5.12\go-p
    ear.phar”
    Warning: require_once(phar://go-pear.phar/index.php): failed to open stream: man
    ifest cannot be larger than 100 MB in phar “D:\wamp\bin\php\php5.5.12\go-pear.ph
    ar” in D:\wamp\bin\php\php5.5.12\go-pear.phar on line 1271

    Call Stack:
    0.0110 313904 1. {main}() D:\wamp\bin\php\php5.5.12\go-pear.phar:0

    D:\wamp\bin\php\php5.5.12>

    1. I just found the solution to this same problem as i had it. All you need to do is to go to: http://pear.php.net/go-pear.phar. While here, press ctrl + S to save the file. As so file name, do well to type in go-pear.phar ( i do not know why this is so very sensitive)
      and hit enter. Then continue as the error is not expected to show up again. at least this solved mine.

  3. If you receive the error: ‘symfony’ is not recognized as an internal or external command, operable program or batch file then please read the steps for adding PHP and MySQL as windows environment variables above. have this message. followed the path as says into the tutorial. wondering what happen

    1. It looks like symfony was not installed correctly due to an issue with pear. Possible a corrupted, older version or unable to download pear. Follow the instructions on this page https://pear.php.net/go-pear.phar. It recommends the following:
      1) Download this file and save it as go-pear.php
      2) Open a terminal/command prompt and type: php -q go-pear.php
      3) Follow the instructions, done!

Leave a Reply