Make sure you sign up to our...
Weblincs welcomes our n...
VAT has changed to 15%! With...
WebLincs.co.uk has recently ...
This article is only useful if the Symfony framework is installed on the server in question. If this is not the case then we suggest that you "freeze" the project on your development environment and FTP it up to your shared hosting account. If you wish to install the Symfony framework on a shared hosing environment, please read this article.
Developing symfony projects usually require that you have access to httpd (Apache) configurations so that you may modify the virtual host to include the symfony sf/ directory from the symfony installation. This is as well as changing the DocumentRoot, pointing it to the web/ directory of your symfony project instead of public_html (the default web root of cPanel accounts).
Overcoming this issue must be done in a way that does not tamper with the way cPanel functions, namely modifying httpd.conf to suit the symfony directives. This could cause cPanel to become corrupt, running the risk of it crashing.
To do this, we use symlinking via the bash terminal over SSH. Symlinking the directories means that cPanel's httpd configuration is not changed. Please see below for the commands to do this. Let's say that we have set up the following account in cpanel, "/home/example", and that you're creating a new
symfony project, "my_app", for this user - the steps to take are as follows:
WARNING: These commands require you to completely delete the "public_html" directory in your shared hosting account.
[example@server example]# mkdir webapps
[example@server example]# mkdir webapps/my_app
[example@server example]# cd webapps/my_app
[example@server my_app]# symfony new my_app
[example@server my_app]# symfony app my_app frontend
[example@server my_app]# cd ~/
[example@server example]# rm -rf public_html
[example@server example]# ln -s webapps/my_app/web public_html
[example@server example]# cd public_html
[example@server public_html]# ln -s /usr/local/lib/php/data/symfony/web/sf/ sf
...And you're done!
Please note that the last command links the /sf directory to /sf in your application's /web directory. This path must relate to your particular installation of symfony.
Back to Web Development Articles.