Development

InstallingSymfonyOnServerGrove (diff)

You must first sign up to be able to contribute.

Changes between Version 5 and Version 6 of InstallingSymfonyOnServerGrove

Show
Ignore:
Author:
pgodel (IP: 129.171.249.140)
Timestamp:
06/22/09 23:39:07 (8 years ago)
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • InstallingSymfonyOnServerGrove

    v5 v6  
    1 == Shared Hosting Server Installation guide for web applications developed with Symfony Framework == 
    2  
    3 Note: This instructions are valid only for Symfony 1.0.x. If you use Symfony 1.1 or newer check out our [http://www.servergrove.com/symfonyhosting website for more instructions]. 
    4  
    5 We recommend that you check our latest product for Symfony hosting called [http://blog.servergrove.com/2009/03/24/introducing-maestro-hosting-symfony-applications-has-never-been-easier/ Maestro]. It allows you to install and configure Symfony projects in our servers quick and easy. View the [http://blog.servergrove.com/2009/03/26/maestro-screencast/ screencast] to see how it works. 
    6  
    7 If you prefer to manually install and configure Symfony, you can continue reading this guide. 
    8  
    9 This guide should be used to install web applications developed with Symfony Framework on [http://www.servergrove.com/symfonyhosting 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. 
    10  
    11 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. 
    12  
    13 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. 
    14  
    15 The web document root of your website is located in /httpdocs. 
    16  
    17 '''Step 1. Upload files''' 
    18  
    19 Upload your symfony project files into symfony_projects, i.e. /symfony_projects/myproject 
    20  
    21 Your directory structure would look like this: 
    22 {{{ 
    23 [user@sg106 symfony_projects]# 
    24 
    25 |__myproject 
    26 | |__batch 
    27 | |__config 
    28 | |__test 
    29 | | |__bootstrap 
    30 | | |__unit 
    31 | | |__functional 
    32 | | | |__demo 
    33 | |__plugins 
    34 | |__cache 
    35 | | |__demo 
    36 | | | |__dev 
    37 | | | | |__config 
    38 | |__lib 
    39 | | |__model 
    40 | |__web 
    41 | | |__css 
    42 | | |__js 
    43 | | |__uploads 
    44 | | | |__assets 
    45 | | |__images 
    46 | |__data 
    47 | | |__sql 
    48 | | |__model 
    49 | |__log 
    50 | |__doc 
    51 | |__apps 
    52 | | |__demo 
    53 | | | |__config 
    54 | | | |__modules 
    55 | | | | |__help 
    56 | | | | | |__config 
    57 | | | | | |__templates 
    58 | | | | | |__validate 
    59 | | | | | |__lib 
    60 | | | | | |__actions 
    61 | | | |__templates 
    62 | | | |__lib 
    63 | | | |__i18n 
    64 }}} 
    65  
    66 '''Step 2. Setup httpdocs''' 
    67  
    68 On shared server accounts, the web document root is located in /httpdocs while symfony expects the web document root to be in `myproject/web` 
    69  
    70 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. 
    71  
    72 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 
    73  
    74 {{{ 
    75 <?php 
    76  
    77 define('SF_ROOT_DIR',    realpath(dirname(__FILE__).'/..')); 
    78 define('SF_APP',         'demo'); 
    79 define('SF_ENVIRONMENT', 'prod'); 
    80 define('SF_DEBUG',       false); 
    81  
    82 require_once(SF_ROOT_DIR.DIRECTORY_SEPARATOR.'apps'.DIRECTORY_SEPARATOR.SF_APP.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'config.php'); 
    83  
    84 sfContext::getInstance()->getController()->dispatch(); 
    85 }}} 
    86  
    87 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: 
    88  
    89 {{{ 
    90 define('SF_ROOT_DIR',    realpath(dirname(__FILE__).'/../symfony_projects/myproject')); 
    91 }}} 
    92  
    93 '''Step 3. Final symfony configuration''' 
    94  
    95 Now, it is time to configure your symfony application to know where to find the web and upload directories. 
    96  
    97 In config/config.php of your application add the following lines: 
    98  
    99 {{{ 
    100    sfConfig::add( 
    101        array( 
    102            'sf_web_dir' => SF_ROOT_DIR.'/../../httpdocs', 
    103            'sf_upload_dir' => SF_ROOT_DIR.'/../../httpdocs/'.sfConfig::get('sf_upload_dir_name'), 
    104        )); 
    105 }}} 
    106  
    107 Go ahead and test your installation by going to our url, like: http://mydomain.com/index.php 
    108  
    109 You can now enjoy your Symfony applications in [http://www.servergrove.com/symfonyhosting.php ServerGrove] shared accounts. 
     1Please go to our updated [http://blog.servergrove.com/2009/06/22/setup-guide-for-installing-a-symfony-project-to-servergrove-shared-hosting-accounts/ setup guide].