Installing Symfony Framework into XAMPP for Windows

Installing Symfony Framework into XAMPP for Windows

Getting started

  1. Download a fresh copy of ApacheFriend XAMPP System and install it according to the tutorials.
    http://www.apachefriends.org/de/xampp-windows.html
  2. In the next step, we have to set the right include path to make sure that all pear packages will be installed in the right locations.
    1. Goto System Properties into the Advanced tab.
    2. Click on Environment Variables
    3. Extend the path variable by adding your path to php, mysql and pear:In my case, as I installed XAMPP to d:\progs\xampp, it was like adding

      ;d:\progs\xampp\php\PEAR\symfony;d:\progs\xampp\mysql\bin;d:\progs\xampp\php;d:\progs\xampp\php\PEAR

  3. Open a command line (Start menu, Start Application, Run „cmd“
  4. Enter your XAMPP directory:
    d:
    cd progs\xampp 

    (This folder might be different for you!)

     

  5. Upgrade pear:
    pear upgrade pear
  6. Install phing:
    pear install -a http://phing.info/pear/phing-current.tgz –alldeps
  7. Install symfony:
    1. pear channel-discover pear.symfony-project.com
    2. pear install symfony/symfony
  8. Update your \xampp\apache\conf\httpd.conf: #
    # Use name-based virtual hosting.
    #
    NameVirtualHost myproject:80
    #access to /sf – directory
    Allow from All
    #symfony myproject
    ServerName myproject
    DocumentRoot „d:\progs\xampp\htdocs\myproject\web“
    DirectoryIndex index.php
    Alias /sf „D:\progs\xampp\php\PEAR\symfony\data\web\sf“
    AllowOverride All
    Order allow,deny
    Allow from All
  9. Update your C:\WINDOWS\system32\drivers\etc\hosts:
  10. Start your console again and change dir into the xampp\htdocs and create the directory „myproject“ there.
  11. Run symfony generate:project myproject
  12. Run symfony generate:app frontend (This assumes, you will need a app called frontend.)
  13. Open http://myproject/ in your browser. You should see the default symfony page, saying:
    Symfony Project Created Congratulations! You have successfully created your symfony project.
  14. Start your own Symfony project now!

16 Comments

  1. Walter Lowell 11. Februar 2013 at 04:19 - Reply

    Greate post. Keep writing such kind of info on your site.
    Im really impressed by your site.
    Hey there, You’ve done an incredible job. I’ll definitely
    digg it and individually suggest to my friends.
    I am confident they’ll be benefited from this web site.

  2. Mike Schwedt 23. Februar 2013 at 21:25 - Reply

    Thanks for the info. One thing though, step 3 on Win 7 should include ‚run as administrator‘.

  3. Gintare 4. Juli 2014 at 16:17 - Reply

    I am getting the error message:
    „Firefox can’t establish a connection to the server at myproject.“

    I went though all your suggested steps several times.

  4. Gintare 4. Juli 2014 at 16:25 - Reply

    My httpd.conf looks like this:
    # Use name-based virtual hosting.
    #
    NameVirtualHost myproject:80
    #access to /sf – directory
    Allow from All
    #symfony myproject
    ServerName myproject
    DocumentRoot “C:\xampp\htdocs\myproject\web”
    DirectoryIndex index.php
    Alias /sf “C:\xampp\php\PEAR\symfony\data\web\sf”
    AllowOverride All
    Order allow,deny
    Allow from All

    I have checked that directory „C:\xampp\php\PEAR\symfony\data\web\sf” does not exists, it is not created during installation. The directrory „C:\xampp\htdocs\myproject\web” exists.

    • Sven Seiler 10. Juli 2014 at 21:15 - Reply

      It seems like your Symonfy folder is located elsewhere. Do you get any errors, when running step 7?

      Install symfony:
      pear channel-discover pear.symfony-project.com
      pear install symfony/symfony

      You might check, if it will be installed into another folder.
      This tutorial is rather old. I wrote about it in 2011 already and things might have changed since then.

  5. Kim 21. November 2014 at 04:11 - Reply

    Thank for you help but I not pass on step 6

    C:\xampp\php>pear install -a http://phing.info/pear/phing-current.tgz-alldeps
    Could not download from „http://phing.info/pear/phing-current.tgz-alldeps“ (File
    http://www.phing.info:80/pear/phing-current.tgz-alldeps not valid (received: HT
    TP/1.0 404 Not Found

  6. Andrew 3. Januar 2015 at 19:07 - Reply

    pear uninstall phing/phing

    and then:

    pear install –alldeps phing/phing-beta

    • Sven Seiler 6. Januar 2015 at 21:49 - Reply

      Thanks for you feedback. I wrote the article first back in 2012. It might not be still fully valid.

      • Gintare 9. Januar 2015 at 13:13 - Reply

        One more way to install symfony on Windows is
        1) to install WAMP from Bitnami

        2)to follow steps in https://wiki.bitnami.com/Components/PHP_Frameworks/Symfony

        Uncomment the following line that you can find in the Apache configuration file installdir/apache2/conf/bitnami/bitnami-apps-prefix.conf:

        Include „installdir/frameworks/symfony/conf/httpd-prefix.conf“

        Restart the Apache server: $ ./ctlscript.sh restart apache
        It is also possible to restart Apache from „All Prorgams“ -> „Bitnami Wampstack“ -> „Wampstack manager tool“ – > „Manage Servers“ -> „Restart“.

        3) Point your browser to http://127.0.0.1/symfony/app_dev.php
        Follow steps in http://symfony.com/doc/2.5/quick_tour/the_big_picture.html

        On Windows systems, execute the following console command:
        c:\> php -r „readfile(‚http://symfony.com/installer‘);“ > symfony.phar

        Save or move file symfony.phar to the directory where you create the Symfony projects and then, execute the Symfony installer right away with this command:
        c:\> php symfony.phar

        Create a new project called myproject:
        c:\> php symfony.phar new myproject
        This command downloads the latest Symfony stable version and creates an empty project in the myproject/ directory so you can start developing your application right away.

        Run the project from its directory:
        $ cd myproject/
        $ php app/console server:run

        Open your browser and access the http://localhost:8000 URL to see the Welcome page of Symfony.

    • Gintare 7. Januar 2015 at 09:42 - Reply

      Thank you so much!

  7. foysal 20. Mai 2015 at 06:05 - Reply

    Could you please help me in this issue?? Thanks

    https://github.com/FriendsOfSymfony/FOSUserBundle/issues/1837

    • Sven Seiler 12. Juni 2015 at 17:41 - Reply

      Sorry, but I am not so much anymore in Symfony. I think I can´t help with this issue.

  8. olivedev 15. September 2016 at 13:16 - Reply

    I was looking to install Symfony on Debian, but couldn’t find any tutorial except for this one: https://www.cloudways.com/blog/install-symfony-3-on-cloud/
    This tutorial uses a specific platform called Cloudways, which sounds like a good tool. But I am just looking for manual installation of Symfony 3 on Debian.

  9. Tarquinius Superbus 12. Dezember 2016 at 20:31 - Reply

    Install Symfony through PEAR is no longer supported: https://symfony.com/blog/end-of-pear-support-for-symfony
    Try Symfony Installer utility or Composer: https://symfony.com/download

Leave A Comment