Support / KnowledgeBase

 
Search the KnowledgeBase Search

How can I Install Symfony PHP framework on the (gs) Grid-Service?

  • Applies to: (gs)

  • Difficulty: Easy

  • Time needed: 5 minutes

  • Tools needed: None

 

Things you will need:

NOTE:

The authoritative source of this documentation can be found here.

Be sure to replace ##### with your site number.

Preparation:

The first thing you will have to do is perform a local installation of PEAR. This step MUST be completed before continuing with the rest of this document. Not having a local installation of PEAR will most likely not even allow you to attempt the installation of the symfony framework. Please follow the instructions linked from the above "Things you will need" section before continuing.

After you've configured PEAR to operate off a local installation, you must pass an environment variable through your ~/.bash_profile file for PHP to run as PHP5 in command-line. This can be done by using the following command:

echo export 'PATH=/usr/local/php5/bin:$PATH:/home/#####/users/.home/pear' >> ~/.bash_profile

Where '####' is your actual site number.

You may test to make sure the variable was passed properly by typing:

cat ~/.bash_profile

You should see something like this:

#MTSTART
export PATH=$PATH:/home/#####/data/rubygems/bin:/home/249/data/rubygems/gems/bin
export RUBYLIB=/home/#####/data/rubygems/local/lib/site_ruby/1.8
export GEM_HOME=/home/#####/data/rubygems/gems
#MTEND
export PATH=/usr/local/php5/bin:$PATH:/home/#####/users/.home/pear

NOTE:

The entries inside of # MTSTART and # MTEND will not conflict with the new variable that you just passed. Nothing will be overridden, just added. (mt) Media Temple recommends you not modify any entries within the # MTSTART and # MTEND headers, as they are directives that we have applied to your server.

We must now refresh your environment variables for your shell session to register the new settings. This has to be done only once. Type the following:

source ~/.bash_profile

Installation:

Your (gs) Grid-Service environment is now set up to properly facilitate the symfony framework. We now proceed to installing symfony using the following method:

You first have to "discover" the symfony PEAR channel:

pear channel-discover pear.symfony-project.com

We then install symfony:

pear install symfony/symfony-beta

NOTE:

Currently, the 1.0 Beta of Symfony works quite well when installed with these instructions. Other versions may vary or require extra steps.

Usage:

Symfony is now installed. At this point you just need to create a directory to house your project and set up a symbolic link from the project's web directory to make it web-accessible. For example we will use 'symfony.mt-example.com', but you may use what ever folder you like in your ~/domains directory:

Make the symfony directory:

mkdir ~/domains/symfony.mt-example.com

Make a project folder within this subdomain:

mkdir ~/domains/symfony.mt-example.com/symfony

Make the 'web' folder for your project:

mkdir ~/domains/symfony.mt-example.com/symfony/web

Establish a symbolic link for 'web' to go to 'html' under your domain:

cd ~/domains/symfony.mt-example.com/
ln -s symfony/web html

Initialize your Symfony project, and then add the proper handlers to the .htaccess file in your 'web' directory for files to be processed using PHP5:

echo 'Options +FollowSymLinks +ExecCGI' >> ~/domains/symfony.mt-example.com/symfony/web/.htaccess
echo 'AddHandler php5-script .php' >> ~/domains/symfony.mt-example.com/symfony/web/.htaccess

This completes all the steps needed to implement this software on your (gs) Grid-Service.

Revisions:

07-20-2009: Minor Fixes
 


User Comments

No visitor comments posted. Post a comment

Fields marked with an asterisk(*) are required. Comment on this article

Fill out the form below if you would like to comment on this article.
 
 
 

(code is not case-sensitive)
 
Submit
 
 

Continue