Development

InstallingSymfonyViaPearRemoteHostWithSSH

You must first sign up to be able to contribute.

Version 16 (modified by Albert.Hidalgo, 10 years ago)
--

Installing Symfony via Pear (Remote Host with SSH)

Prerequisite

  1. The remote host allows SSH login.
  2. http://www.symfony-project.com/content/book/page/installation.html

Problems Faced:

  1. Unable to add the 'symfony channel' with the pear command pear channel-discover pear.symfony-project.com as it requires root access to the server.
  2. With the command php -v, it displays php4 instead of the required version php5.
  3. After symfony is installed successfully, the following problem pops up when trying to run symfony -T :
    PHP Warning: require_once(pake/pakeException.class.php) ...
    
  4. You encounter issues with installing PEAR using php5.
  5. You have no privileges to the shared host's /tmp directory.

The Solution:

1. make sure you are running php5 at the shell...

$ php -v

If its version 4, you need to change to version 5 before running pear. This is easily done by adding the path to the php5 executable to the beginning of your PATH environment variable.

If you don't know where your php5 executable is, try this...

find /usr -name php -type f 2>/dev/null

It should be pretty obvious which path is the one for php5. In my case its at '/usr/local/php5/bin/php' and so the path to my executable is '/usr/local/php5/bin'

Now we know the correct path, we need to add it to our PATH environment variable. The command to do so will vary depending on the type of shell you're using.

It looks similar to:

$ export PATH=/usr/local/php5/bin:$PATH

Note: PATH must be capitalised and $PATH must be appended at the end.

If you couldn't figure out the path to php5 using the above method, try using phpinfo() or check with your hosting company.

try 'php -v' again and you should find that your using php5.

1. Alternative Method

Set the PHP_COMMAND environment variable in your .bashrc to reflect your php5 executable.

export PHP_COMMAND=php5

2. install a local version of PEAR on the remote host (http://pear.php.net/manual/en/installation.shared.php),

$ pear config-create $HOME .pearrc
$ pear install -o PEAR

Note: If you encounter errors with installing PEAR, try using PEAR with PHP4. In this case, '/usr/local/bin/pear'.

$ /usr/local/bin/pear config-create $HOME .pearrc
$ /usr/local/bin/pear install -o PEAR

now you can install symfony as usual (see the symfony book)

3. Lastly, you need to add your pear and symfony executables to your path.

$ cd pear
$ pwd

You will see the path to pear and symfony. In my case its '/home/kaoru/pear'. So I would type..

$ export PATH=/home/kaoru/pear:$PATH

Make sure PEAR is using PHP5.

$ pear -V

If PEAR is not using PHP5, set PHP_PEAR_PHP_BIN to the location of the php5 executable done in step 1.

# export PHP_PEAR_PHP_BIN=/usr/local/php5/bin/php

3. Alternative Method

Set the PHP_CLASSPATH environment variable to wherever the libraries get installed to. ex) $HOME/pear/php

export PHP_CLASSPATH=~/pear/php

4. To make life easier for you, you can add the PATHS you need to your .bash_profile, so that they load automatically at every ssh login.

5. If you are using symfony 1+, then thats it your done! symfony commands should work just fine!

Note: If you encounter problems with access privileges to /tmp, you can change PEAR's target directories.

mkdir -p ~/tmp/pear/cache
mkdir -p ~/tmp/pear/temp
pear config-set download_dir ~/tmp/pear/cache
pear config-set temp_dir ~/tmp/pear/temp

If you are using symfony 0.6.3, pake is not bundled in with symfony and you need to create a symbolic link for the symfony command to work. This is documented in the symfony book, here

if you still get this error...

PHP Warning: require_once(pake/pakeException.class.php) ...

the following might help...

The default pear folder is important; it determines where the pear channel installs the symfony package.

Sample pear folders:

pear config-show
...
PEAR executables directory    $HOME/pear
PEAR documentation directory  $HOME/docs
PEAR directory                $HOME/php
PEAR data directory           $HOME/data

With the above pear directory settings, the PHP warning mentioned earlier will popup.

Note: Pear directory is at $HOME/php and it is where the symfony lib folder is installed to.

In data/symfony/bin/pakefile.php, it is assuming the default folder to be at xxx/lib/... so for the above sample pear setting to work:

  • Change PEAR directory (and re-install symfony) or
  • Open the file, symfony/bin/pakefile.php, for each xxx/lib/..., change to xxx/php/ (replacing "lib" with "php")

Similarly, For pakeFunction.php and pakeFinder.class.php:

  • Change PEAR directory (and re-install symfony) or
  • Open the file, pake/pakeFunction.php, for each require_once statement, remove the "pake/".
  • Open the file, pake/pakeFinder.class.php, for each require_once statement, remove the "pake/".

However, the recommended way would still be changing the PEAR directory instead of changing the codes.

To change PEAR folders,

pear config-set [name of folders]