Installing symfony on shared host via SSH

Prerequisits:

  • Shell access
  • Path to php5 binaries

Generally the path to executable will be something along the lines of /usr/local/php5/bin/php5. For the sake of this guide lets assume that it is the correct path.
First we need to install PEAR locally. The easiest way to do it is via go-pear. Go-pear is a script that takes all the pain from installing PEAR. Log in to your shell and type:

wget http://pear.php.net/go-pear.phar

This will save the go-pear.phar file in the directory you are currently in. Let's assume that it's your home directory e.g. /home/user/

Note:
In some cases you need to ask the Customer Support to enable your shell to run wget.

Now to run the script type:

/usr/local/php5/bin/php5 go-pear.phar

Follow the instructions. The script will understand that you are trying to install PEAR locally so generally all you have to do is press enter.

 

Note:
If you are getting error messages saying that php is unable to download files or that it is unable to extract files it means that php is unable to write to /tmp directory. Ask your friendly Customer Support to fix this.

The script will tell you that you PEAR command is available to you at /home/user/pear/bin/pear. To make things a little easier we will create a symlink to PEAR executable. Type:

ln -s /home/user/pear/bin/pear mypear

Now all you have to type to get to PEAR is ./mypear
Since the name of the php5 executable is php5 and not plain php PEAR will probably will not find it. Never fear! The solution for this is to edit the PEAR executable. Type:

pico /home/user/pear/bin/pear

find these lines:

#!/bin/sh

# first find which PHP binary to use
if test "x$PHP_PEAR_PHP_BIN" != "x"; then
PHP="$PHP_PEAR_PHP_BIN"
else
if test "/usr/local/php5/bin" = '@'php_bin'@'; then
PHP=php
else
PHP="/usr/local/php5/bin"
fi
fi

change

PHP="/usr/local/php5/bin"

to

PHP="/usr/local/php5/bin/php5"

and save the file.
That should take care of installing PEAR.
To install symfony change the PEAR's preferred state for packages to beta by typing:

./mypear config-set preferred_state beta

Install symfony:

./mypear channel-discover pear.symfony-project.com
./mypear install --alldeps symfony/symfony

To run symfony we will force Apache to process .php extension as php5 script instead of the default php4. Edit the .htaccess file in your /home/user/public_html/ directory. Type:

pico /home/user/public_html/.htaccess

Add a line:

AddHandler application/x-httpd-php5 .php

and save the file.

That's it! Your symfony framework is ready for you project!

Read about moving your Symfony project to production hosting account.

Метки:
symfony
php
shell

Комментарии

  • Gravatar
  • Digitalinfamy
  • 2009-03-08 04:49:54
Wow Great Information wish I'd found this months ago.. Been struggeling to set symfony up on my shared hosting. The tech support has been rubbish but thanks to this I'm up and running in minutes.. Thanks you so much

© 2003 — 2017 Akinas
Все права защищены