How to install Symfony on GoDaddy Virtual Dedicated Server

I want to share this information with you because I’ve solved this issue and found that it’s not trivial.

We can divide installation process on two stages:
1. Installation Symfony
2. Setting up VDS for using Symfony 

So, first we need to install Symfony itself.
We have to do it with root access.
To get the root access do “su –” command without quotes and enter root password.

The sequence of sommands:

1. # pear upgrade PEAR.
I needed it because I had old pear library installed on my VDS.

2. # pear channel-discover pear.symfony-project.com
This command adds Symfony channel to pear

3. # pear install symfony/symfony
It will take some time for downloading Symfony code, unpacking it and install

That’s all with Symfony installation. You can check the Symfony version by typing command from shell:
# symfony -V

The second stage is setting up our VDS for using Symfony correctly.

In general all setting will be applied to the Apache configuration file. 

As you already know in the Virtual Dedicated Server (VDS) we have the following files structure in our user home:

-bash-3.00$ ls -la
.bash_history
.mc
.mysql_history
.ssh
.viminfo
anon_ftp
bin
cgi-bin
chart_error.log
conf
error_docs
httpdocs
httpsdocs
pd
private
statistics
subdomains
web_users

We’ll be only interested in conf, httpdocs directories.

Go to the httpdocs folder and initialize there Symfony project (from your domain user, not from the root) 

> symfony new projectname
> symfony app application_name

This will create necessary files and folders.

We have DocumentRoot in the httpdocs directory by default. But if we initialize new Symfony application there we’ll need new document root in the httpdocs/web folder, isn’t it?

So we need to change it in the Apache configuration.

I hope you didn’t logoff from the root account, if so please log in again 🙂

After that go to the conf directory in your home. Make ls -la command and you’ll see there two files:

httpd.include
webalizer.conf

We need httpd.include file – this is Apache configuration for your current domain name you’re logged in.

Open it with your VI editor and you’ll see the Virtual host settings.

You have to add the following line in the Virtual Host area:

1. Alias /sf /usr/share/pear/data/symfony/web/sf
where “/usr/share/pear/data/symfony/web/sf” is path to your symfony resources in the pear.
I think this setting is similar to all GoDaddy VDS users.

2. Find DocumentRoot setting and add ‘web’ directory to its end.
Like this: DocumentRoot /var/www/vhosts/domain.com/httpdocs/web

3. And the final, the most interesting part
Find php_admin_value open_basedir (two times)

php_admin_value open_basedir “/var/www/vhosts/domain.com/httpdocs:/tmp” 

and add there another one path, like this:
php_admin_value open_basedir “/var/www/vhosts/domain.com/httpdocs:/tmp:/usr/share/pear/

After all changes above are made you have to restart Apache web server to seting take effect.

# apachectl restart

That’s all.

You have found any issues regarding installation Symfony on GoDaddy VDS feel free to post a comment here and I’ll help you to solve it.