How to deploy my Symfony2 project to ftp

I've searched and tried a couple of tutorials on the internet but none of them worked well for me. The tutorials I read were from the Symfony2, Dator, Hpatoio and Capifony documentation.

Can someone explain to me how I can export my project to my server. For example. This would be very helpful to me.

I have a package and inside packages all controller settings and tween templates etc.

If you have any questions, please ask.

Thanks in advance.


source to share

2 answers

First of all, it should be noted that deploying a Symfony2 application over FTP is really very bad. This makes a few steps more difficult (or even impossible) and should be avoided. If you have SSH access to the machine, see my list of alternative deployment methods below .


There are a few things that you cannot influence when deploying over FTP. Unless you have control over the following, or cannot configure them correctly, you unfortunately have no option to deploy to shared hosting.

  • PHP configuration. If the settings are not set correctly and you have no chance of changing them, you are unfortunately lost.
  • Any PHP module you may need. Same as above. If you cannot install any additional modules that you need, then you have no chance. (An example would be a module php5-intl

    for any Symfony <2.6 )
  • Fix folder permissions. Especially for app/cache

    and app/logs

    . Check documents for requirements.
  • Web server configuration. Symfony needs a properly configured web server (probably apache or nginx in most cases) to work properly. If you can't influence the configuration, that's bad too. You can try to define rewrite rules in the file .htaccess

    as described here .


Below are the steps you need to follow to prepare your application for deployment for the first time :

  • Update / install suppliers. Use composer install

    (or composer update

    ) to install any third party package or library that you use in your project as you have no way to install them later directly on the server.
  • If you are using Assetic to manage assets , make sure you also install them using the command php app/console assetic:dump --env=prod

  • Discard any other assets are as follows: php app/console assets:install --env=prod

    . (This step may not be necessary, but you need to make sure the assets are not symbolic. Check this blog post if you are using symfony> = 2.6 )
  • Clear cache for production: php app/console cache:clear --env=prod

  • Make sure you edit parameters.yml

    yours to suit the needs of your production server.
  • Also update the database schema in your production database if you changed it during development.

You should be good to go now. Copy the entire folder to your server and try it.

In future

If you are redeploying a second time, remember to override any custom data (e.g. uploaded images). Also you need to clear the cache on top of ftp. To do this, create a directory app/cache


Alternative deployment methods

If you have more access to the server, check any of them. They may suit your needs better than the old clean FTP. Perhaps they give you enough reason to upgrade to a better server. Capifony is probably one of the best deployment tools for Symfony2 applications. Deploying will be as easy as running cap deploy

on your local machine. The rest is magic;) Simple git is also possible for deployment. Many of the steps above will still apply, but you have all the benefits git gives you the option of not copying everything on every deployment. A very good list of all the tools can be found in the docs.



It might help if you tell us a little more about setting up your server, but here's a general guideline enough:

  • Assuming you want to download it using ftp (since you've tagged the question as such), you'll need an FTP client (see here for some suggestions).

  • Using an FTP client, you want to connect to the server (hostname: using your credentials (if it is secured by the server).

  • From there you will be able to upload any files from your local machine to the server.

More specific directions will depend on your server configuration and the FTP client you choose (it should have its own manual)



All Articles