Deployment of Symfony2
Steps to move Symfony 2 project to hosting manually
It depends on kind of hosting that you have:
-
If you have SSH console, then you can do it on hosting after step 2, if you haven’t then do it locally: run command
php app/console cache:clear --env=prod'.
-
Suppose you have on you hosting folders
youdomain/public_html
, so inpublic_html
must be located all web files. So you must upload all from Symfony project (folders:app
,src
,vendors
,bin
; files:deps
,deps.lock
), except for folderweb
in folderyoudomain
. Everything from folderweb
upload to folderpublic_html
. -
Check CHMOD for folders
app/cache
andapp/logs
, there should be write access. -
If there is no file .htaccess in public_html, then create it and add such code in it: https://raw.github.com/symfony/symfony-standard/master/web/.htaccess
-
Now you should use
youdomain.com/index
instead ofyoudomain.com/app_dev.php/index
, that you use locally. If a site still did not works, you can open fileweb/config.php
and find a code where a check for IP performs, you find there only IP127.0.0.1
. Add your current IP to this list and upload new config on the server. Then you can open pathyourdomain/config.php
and check what’s wrong. Ifconfig.php
shows that everything ok, but it still didn’t work, you can enableapp_dev.php
to debug: openapp/app_dev.php
and your IP the same way as inconfig.php
. Now you can run scripts as locally usingapp_dev.php
.