Steps to move Symfony 2 project to hosting?
OK, I find out how to correctly deploy app on shared hosting. Here it is:
- It depends on kind of hosting that you have: if you have SSHconsole, then you can do it on hosting after step 2, if you haven'tthen 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. You must upload all from Symfony project (folders: app, src, vendors, bin; files: deps, deps.lock), except folderweb
in folderyoudomain
. Everything from folderweb
should be upload to folderpublic_html
. - Check CHMOD for folders app/cache and app/logs, there should bewrite access.
- If there is no file
.htaccess
inpublic_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 your site still did not works, you can open file web/config.php
and find the code where the check for IP performed, you find there only IP 127.0.0.1, add your current IP to this list and upload new config on a server. Then you can open path yourdomain/config.php
and check what's wrong. If config.php
shows that everything ok, but your site still didn't work, you can enable app_dev.php
to debug: open app/app_dev.php
and add your IP to the list as for config.php
done before. Now you can run scripts as locally using app_dev.php
.