How to upload a symfony website to a shared host in 7 steps

For a beginner, uploading a symfony website to a shared host like Cpanel, Plesk, Kloxo, Direct Admin or etc is a frustrating task. Some may give up on using the host and just purchase a VPS instead of using a shared hosting solution. In my case, just an answer regarding the feasibility of using a shared host with symfony was enough but I couldn’t find one; well the good news is, I uploaded symfony websites to all mentioned control panels' shared hosts successfully, even on a windows shared hosting (Plesk control panel) with IIS server installed. Ok, there may be a lot of questions that occupy developer’s mind such as are pear packages or SSH access requirement on the shared hosting required in order to do such task? You don't need any further access except the control panel's access! Just follow the mentioned steps and you are good to go but remember that these steps worked and tested for symfony 1.4.

What is symfony?

Symfony is a PHP framework and a very good solution to implement enterprise level applications. Currently the symfony is in its 2 version.

What is shared hosting?

Shared hosting provides a web space and databases on a shared web server for you. On a shared hosting server your website is not the only one on the server; as a matter of fact sometimes thousands of websites are hosted on a single server. 

Which shared hosting companies support symfony ?

Some shared hosting companies may claim that they support "symfony shared hosting"; although this is not a false claim, all mentioned control panels at the beginning of this article support "symfony".

Step by step guid to upload a symfony website to a shared host

  1. A symfony built website has all of its needed files and you need nothing more than the required PHP version and configurations on the shared host (I tested on a host having PHP version of 5.2.17) so to check this requirement just upload the check_configuration.php .to your shared host and run it by putting the address pointing to this file in browser. For example if you upload it to your shared host's root and your host address is then you should go to the address: .
  2. If you passed previous step then you are good to perform following steps. Clear your cache either using symfony cc command or just simply deleting all the files in the cache folder.  It is also recommended that you delete files in your log folder.
  3. Create a database in your shared host and set a username and password. Put these database name, username and password in your Config/database.yml file. Export your tables and data into a file from your localhost and import it to the created database.
  4. Zip your symfony web site folder and files. Typically the zip should contain these 10 folder and files: apps, cache, config, data, lib, log, plugins, test, web, symfony. Upload and extract this zip to your shared host let’s say public or httpdocs folder.
  5. Change permissions of cache and log folder (in your host) to full control or 777.
  6. Change directory root of your shared host to point to the web folder
    1. If you’re using other folder name rather than web then you need to introduce it to symfony by putting this line $this->setWebDir($this->getRootDir(‘[whatever name you gave]’)) in your config/ProjectConfiguration.Class.php and setting host's document root to point to that folder.
  7. If you are uploading your website to a windows shared host with IIS installed as web server --let’s say plesk control panel—then you have a problem to access other links of your site except the home. The problem originates from the fact that IIS can’t process .htaccess file and you need to introduce it someway that IIS recognize. Ok IIS uses url rewrite module to process user friendly urls and you can follow this article to learn how to convert an .htaccess file to equivalent web.config file but in symfony 1.4 case you can simply download and use this web.config file and upload it to your web folder.
Read 4928 times Last modified on Sunday, 30 August 2015 07:19
Rate this item
(1 Vote)
About Author
Leave a comment

Make sure you enter the (*) required information where indicated. HTML code is not allowed.

Advanced Programming Concepts
News Letter

Subscribe our Email News Letter to get Instant Update at anytime