One of the things we spend lots of time on, is trying to make application deployment as simple as possible so developers can focus on development. We are developers as well, so when we finish a project, we want to upload it, test it and start on the next project. Keep it simple, move on. Like you, we don’t like to fight with configuration, permissions and whatever other issues may delay our deployment. Most of our in-house projects are developed in symfony, so we have gotten particularly good at fine tuning our servers for this framework (not to mention it’s the best framework in the world).

As a policy, we help all our clients with migration and installation issues. A great majority of our support time is dedicated to this type of service, so the easier it is for people to install their apps, the less time we spend answering tickets. We like to call this: motivation.

While most people seem to be figuring out how to use Maestro and get their apps up and running on our servers without much difficulty, we decided to write this setup guide for setting up symfony applications quickly on ServerGrove shared hosting accounts.

Note: Guide is for symfony 1.x

1) Preparation

There are a few steps you can take to make the installation of your application a breeze, and while we try to configure our servers to be as transparent as possible for developers, it is impossible to match everybody’s environment and/or preferences. Here are a few things to keep an eye out for:

a) Make sure all paths are unix-based. Developers running on windows will have their paths with C:\symfony or similar structures. Our servers run on Linux, so you need to use unix-based paths like /usr/local/php/symfony12

b) The Linux filesystem is case-sensitive, so Symfony and symfony will be different names. Make sure your code paths and file names match the names of the files and directories.

c) On shared hosting accounts, your home directory will be in /var/www/vhosts/example.com . Your symfony project files will reside in /var/www/vhosts/example.com/symfony_projects/PROJECT_NAME (replace example.com and PROJECT_NAME with your names, remember, domain names are lowercase and the project names are case-sensitive). Keep these paths and names in mind as you will need to use them in different places to properly configure your project and applications.

2) Paths Configuration

Before you upload your symfony project, you need to configure your project to find the symfony library. All our servers have symfony libraries pre-installed, so you can use the server-wide installation.

a) Use server-wide symfony installation (recommended)
The server-wide libraries are in /usr/local/php/. Here are the paths for the different versions of symfony:
symfony 1.0.x : /usr/local/php/symfony10/lib
symfony 1.1.x : /usr/local/php/symfony11/lib
symfony 1.2.x : /usr/local/php/symfony12/lib

To configure a Symfony 1.0.x project, edit config/config.php and setup the proper paths for the symfony library:

<?php

// symfony directories
$sf_symfony_lib_dir  = '/usr/local/php/symfony10/lib';
$sf_symfony_data_dir = '/usr/local/php/symfony10/data';

To configure a symfony 1.1.x, edit the config/ProjectConfiguration.class.php file:

 


require_once ‘/usr/local/php/symfony11/lib/autoload/sfCoreAutoload.class.php’;
sfCoreAutoload::register();

class ProjectConfiguration extends sfProjectConfiguration
{
public function setup()
{
// for compatibility / remove and enable only the plugins you want
$this->enableAllPluginsExcept(array(‘sfDoctrinePlugin’, ‘sfCompat10Plugin’));
}
}
[/CODE]

To configure a symfony 1.2.x project, edit the config/ProjectConfiguration.class.php file:

 


require_once ‘/usr/local/php/symfony12/lib/autoload/sfCoreAutoload.class.php’;
sfCoreAutoload::register();

class ProjectConfiguration extends sfProjectConfiguration
{
public function setup()
{
// for compatibility / remove and enable only the plugins you want
$this->enableAllPluginsExcept(array(‘sfDoctrinePlugin’, ‘sfCompat10Plugin’));
}
}
[/CODE]

b) Alternatively, you can upload your symfony library. If you do so, make sure you configure your project to have the correct unix paths described in bullet 1.C

3) Database configuration

Your symfony applications will probably use Mysql to load and save data. The Mysql database will be running in localhost. We recommend that you create the database and tables, and load the data before uploading the site. In order to do so:

a) login into the Control Panel with your username and password which you can find in the email with subject “New account information”.

b) once in the control panel, select the domain and go to the Databases section.

c) create the database and then create the user to access the database.

db

db2

d) click on the phpMyAdmin icon, this will open a popup with the admin interface.

e) select the database. Now you can import a SQL file with all the statements to create tables and insert data

db3

Refer to the phpMyAdmin manual for more information on how to use this powerful tool.

4) Transfer files

You already configured your paths, created the database and imported the data. Now you are ready to upload the project files. You will need to use a FTP client to connect to the server. You can find the FTP login information in the email with subject “New account information”.

Once you have connected to the server, go into the symfony_projects directory. Upload your project so all the project files end up in the contained in a directory residing in symfony_projects (ie. symfony_projects/myproject)

5) Configure Apache to use your symfony project web root.

Once you finished upload the files, it is time to configure the Apache web server to use the project web directory as the document root. For this, we recommend that you use our Control Panel extension, Maestro. To learn more about Maestro, go to the release announcement and watch the screencast

maestro

6) Something is wrong…

If something did not go right, we recommend that you look at the different log files that may contain critical information to fix the problem:

a) the Apache error log may contain warnings about Apache configuration error, the file is located in statistics/logs/error_log

b) in our servers, each website has its php error log. This file may contain warnings and fatal errors, you can find this file in statistics/logs/php.log or you can see it online through Maestro’s ajax-based log viewer.

c) if your symfony application is configured to log errors and messages, you can find those in symfony_projects/PROJECT_NAME/log

logviewer

If you are unable to find any errors or locate the problem, feel free to contact us and we will assist you to get your site running as fast as possible.

7) Done!

If you followed these steps, your symfony-based site should be up and running.

We would like to hear from you: Please take some time to tell us how was your installation and setup experience, and specially, if there are any steps that need improvement.