Development

InstallingSymfonyOnServerGrove

You must first sign up to be able to contribute.

Version 5 (modified by pgodel, 9 years ago)
--

Shared Hosting Server Installation guide for web applications developed with Symfony Framework

Note: This instructions are valid only for Symfony 1.0.x. If you use Symfony 1.1 or newer check out our website for more instructions.

We recommend that you check our latest product for Symfony hosting called Maestro. It allows you to install and configure Symfony projects in our servers quick and easy. View the screencast to see how it works.

If you prefer to manually install and configure Symfony, you can continue reading this guide.

This guide should be used to install web applications developed with Symfony Framework on ServerGrove servers. It requires a good understanding of Symfony and its directory structure. It also requires that you already have a Symfony project ready to be uploaded.

All our servers come with Symfony framework pre-installed. This means that you only have to upload your symfony project files and make the appropiate configuration changes so your application works on a shared hosting environment.

In your shared hosting ftp root directory you will find a directory called "symfony_projects". We recommend that you upload your projects into this directory.

The web document root of your website is located in /httpdocs.

Step 1. Upload files

Upload your symfony project files into symfony_projects, i.e. /symfony_projects/myproject

Your directory structure would look like this:

[user@sg106 symfony_projects]#
.
|__myproject
| |__batch
| |__config
| |__test
| | |__bootstrap
| | |__unit
| | |__functional
| | | |__demo
| |__plugins
| |__cache
| | |__demo
| | | |__dev
| | | | |__config
| |__lib
| | |__model
| |__web
| | |__css
| | |__js
| | |__uploads
| | | |__assets
| | |__images
| |__data
| | |__sql
| | |__model
| |__log
| |__doc
| |__apps
| | |__demo
| | | |__config
| | | |__modules
| | | | |__help
| | | | | |__config
| | | | | |__templates
| | | | | |__validate
| | | | | |__lib
| | | | | |__actions
| | | |__templates
| | | |__lib
| | | |__i18n

Step 2. Setup httpdocs

On shared server accounts, the web document root is located in /httpdocs while symfony expects the web document root to be in myproject/web

This means that you need to place the contents of web into httpdocs. Make sure you include all the files of the directory including the .htaccess file.

Once you uploaded the files, you need to make a change in the index.php and any other entry point files for the applications. The index.php file will look like

<?php

define('SF_ROOT_DIR',    realpath(dirname(__FILE__).'/..'));
define('SF_APP',         'demo');
define('SF_ENVIRONMENT', 'prod');
define('SF_DEBUG',       false);

require_once(SF_ROOT_DIR.DIRECTORY_SEPARATOR.'apps'.DIRECTORY_SEPARATOR.SF_APP.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'config.php');

sfContext::getInstance()->getController()->dispatch();

You need to modify the definition of SF_ROOT_DIR to tell Symfony where to find the root of your project. By following the prior step, you can make the following change:

define('SF_ROOT_DIR',    realpath(dirname(__FILE__).'/../symfony_projects/myproject'));

Step 3. Final symfony configuration

Now, it is time to configure your symfony application to know where to find the web and upload directories.

In config/config.php of your application add the following lines:

   sfConfig::add(
       array(
           'sf_web_dir' => SF_ROOT_DIR.'/../../httpdocs',
           'sf_upload_dir' => SF_ROOT_DIR.'/../../httpdocs/'.sfConfig::get('sf_upload_dir_name'),
       ));

Go ahead and test your installation by going to our url, like: http://mydomain.com/index.php

You can now enjoy your Symfony applications in ServerGrove shared accounts.