Skip to content

Installing symfony on Dreamhost using PEAR

I tried to get all of the commands put down in this how-to, so that people of all skill levels could follow the instructions. Be sure to let me know if I missed any or something needs clarified. :) But as usual, use at your own risk, yadda, yadda.

Conventions used in this how-to (replace with the appropriate values for your account as needed):

  • username: your main account username
  • projects_directory: the directory in which you’ve gathered the non-web files of all your projects. I’m working on the assumption that this directory is outside the web-accessible domain directories (e.g. /home/username/projects_directory).
  • project_name: the name of a project for which you’ve created a subdirectory (/home/username/projects_directory/project_name).
  • example.com: domain or subdomain where you wish to have the symfony project be accessed (located /home/username/example.com and viewed on the web at http://example.com).
  • $ is the just a placeholder for the shell prompt. (You’ll actually see something like [server_name]$, which is just showing which server your account is on.) This is just a visual cue that you’re typing the commands that follow it in at the shell prompt.
  • text in this font is meant to be typed in by you (when preceded by the shell prompt: $) or is explaining directory structure (e.g. /home/username).
  • This site has a good list of linux commands, if you’re not familiar with them. The ones you’ll need the most for this are cd, pwd, mkdir, ln and rm.

Ok, on with the instructions. :)

  1. Install a custom pear installation on your account (instructions adapted from here).
    1. Log in to your shell account and issue the following commands in your home directory (/home/username):
      1. $ pear config-create $HOME .pearrc
      2. $ pear config-set download_dir /home/username/tmp/pear/cache
      3. $ pear config-set cache_dir /home/username/tmp/pear/cache
      4. $ pear config-set temp_dir /home/username/tmp/pear/temp
      5. $ pear install -o PEAR
      6. $ export PHP_PEAR_PHP_BIN=/usr/local/php5/bin/php
      7. $ export PATH=/home/username/pear:/usr/local/php5/bin:$PATH
        (N.B. You’ll need to repeat commands 6 and 7 each time you log in to shell if you plan on using the command line interface. If you want to have the changes be made automatically when you log in, you’ll need to add those two lines to your .bash_profile in your home directory.)
    2. Check to make sure everything worked:
      1. $ which php should answer /usr/local/php5/bin/php.
      2. $ php -v should answer that the version is >= 5.0. (Necessary because symfony is written for PHP ver. 5+)
      3. $ which pear should answer /home/username/pear/pear.
      4. $ pear -V should answer that the version is >= 1.4.0. (Which is necessary because of the use of channels to install symfony from the project’s server.)
  2. Install symfony (instructions summarized from here):
    1. Tell pear to find the symfony project’s channel: $ pear channel-discover pear.symfony-project.com
    2. List the projects available for download from this channel (symfony should be listed in the results): $ pear remote-list -c symfony
    3. Tell pear to install symfony from the symfony channel: $ pear install symfony/symfony
    4. Check what version of symfony is now installed: $ symfony -V should answer something like symfony version 1.0.5.
  3. Create a directory to store your projects in, above the web accessible domain directories (/home/username/projects_directory): $ mkdir projects_directory
  4. Create your project and application(s). In the projects_directory:
    1. Create a directory for your project: $ mkdir project_name
    2. Change directories to the one you just created: $ cd project_name
    3. Tell symfony to create the project: $ symfony init-project project_name
    4. When you list the directory ($ ls -la), you should see a directory structure something like this:

      apps/
      batch/
      cache/
      config/
      data/
      doc/
      lib/
      log/
      plugins/
      test/
      web/

    5. Create the application: $ symfony init-app app_name. That creates a app_name/ directory in the apps/ folder of the project root.
  5. Create symbolic links (adapted from here):
    1. This link tells the server where the symfony images, CSS files, etc., are for the administration pages (type this all on one line): ln -s /home/username/pear/data/symfony/web/sf /home/username/projects_directory/project_name/web/sf
    2. This creates a symbolic link (symlink) the web directory of your symfony project to wherever you want it to be on your website (all on one line): ln -s /home/username/projects_directory/project_name/web /home/username/example.com
    3. When you list the directory’s contents, you’ll notice that this makes a link that looks like this: web -> /home/username/projects_directory/project_name/web, which displays at example.com/web, rather than at the top level of example.com. To fix that, go to the DreamHost control panel -> domains -> manage domains. Edit the web directory for the domain from /home/username/example.com to /home/username/example.com/web. Wait five to ten minutes for the changes to to populate, then refresh your browser at example.com. (Found that hint here.)

      If, for whatever reason, you typed the symlink in wrong, you can remove it by typing $ rm link_name (link_name in this case is web).

Et voilĂ ! :)

Updates:

Aug. 15, 2007: added pear config-set commands (I-A-2 through I-A-4).

ETA: To view all installed pear packages from all channels, type $ pear list -a

ETA the second: I don’t use symfony (this was pretty much just an exercise to see if I could get it to work correctly so I could evaluate it when I was looking at frameworks), so this tutorial won’t be updated as the installation process for symfony changes. I’ll leave it up, however, because it can still function as a starting place for figuring out what won’t work when you’re trying to install. :)

28 Comments

  1. I just come across this tutorial.
    Excellent, this is exactly what I was looking for.

    Thanks.

    Monday, July 16, 2007 at 11:42 am | Permalink
  2. herself wrote:

    You’re most welcome, Simone. Glad you found it of use! :)

    Monday, July 16, 2007 at 6:51 pm | Permalink
  3. Naud wrote:

    hi,

    I have installed a symfony app on DreamHost but it bugs (horrible “Oops! An Error Occurred
    The server returned a “500 Internal Server Error”.” from the symfony 500 erro page that I did not customized). So I tried those steps that you provide.

    But, it bugs for me on step A I 2 (pear install -o PEAR)…

    I have error messages like:
    (…)Error: cannot download “pear/PEAR”
    (…)Error: cannot download “pear/Archive_Tar”(…)

    And when I try a which pear, I get :
    which pear
    /usr/local/php5/bin/pear
    (and not /home/myusername/pear/pear)

    Does it says something to you ?

    Is it important that my pear be
    /home/myusername/pear/pear instead of
    /usr/local/php5/bin/pear ?

    Thanx !

    Saturday, August 11, 2007 at 12:41 pm | Permalink
  4. Naud wrote:

    I solved step A I 2 doing that first :
    $ 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

    Now I can access my pear !!

    Saturday, August 11, 2007 at 1:19 pm | Permalink
  5. Sito wrote:

    Would you happen to know how to install the askeet demo on dreamhost? I was able to run through what you wrote out in steps above but when trying to do day 24 of the askeet software package I’m not quite sure what’s going wrong. Wondering if you had any luck.

    thanks for all the help

    Saturday, August 11, 2007 at 10:45 pm | Permalink
  6. Christopher Lewis wrote:

    Please never take this info down. It works like a charm.

    Monday, August 13, 2007 at 2:23 pm | Permalink
  7. Eric wrote:

    I’m having the same problem as NAUD, I tried those extra steps but it still doesn’t work, I was able to follow this tutorial successfully yesterday, but not today, I think Dreamhost has been messing with the servers, some of them are down today

    Wednesday, August 15, 2007 at 3:21 pm | Permalink
  8. Herself wrote:

    Sito: I haven’t tried to install the askeet demo, sorry. :( What’s the error it’s giving you? (No guarantees I know what it is, of course.)

    Naud & Eric: You know, I vaguely remember having an issue the first time (months and months ago) that I tried to install pear, and I remember editing the configuration directories for it. Try typing:

    pear config-show

    at the command prompt and see what it tells you. The *_dir directories should point to your locally installed version of pear, not the default, limited version installed for general use on the server. Ditto on the php5 directory.

    Wednesday, August 15, 2007 at 8:50 pm | Permalink
  9. Herself wrote:

    Naud:

    Is it important that my pear be /home/myusername/pear/pear instead of /usr/local/php5/bin/pear ?

    Yeah, ‘cuz the default installation of pear that DH does is a very limited version, and users can’t modify what packages or what version is installed. (From the wiki: “Dreamhost includes only a bare set of PEAR modules on shared hosting accounts, and does not allow users to add more to the base install.”)

    Oh! Looks like there are some steps in the pear installation that I did ages ago that I missed, which I see from rereading the wiki page. I’ll add those steps above. :)

    Wednesday, August 15, 2007 at 8:55 pm | Permalink
  10. Herself wrote:

    Thanks, Christopher! I’m glad it worked well for you. :) (Sorry, your comment got caught in the spam filter, so I didn’t see it until tonight when I was cleaning that out.)

    Wednesday, August 22, 2007 at 10:11 pm | Permalink
  11. Just AWESOME! I spent about 4 hours last night trying to get Trac and SVN setup on Dreamhost (still no dice on Trac) by following their less-than-verbose DH wiki articles, but following this to set up Symfony and Pear took less than 30 minutes from start to finish! Thanks so much! Er, any advice on how to add SVN to the instructions above?

    Friday, September 7, 2007 at 2:24 pm | Permalink
  12. mozey wrote:

    I dont understand why you have
    ~user/domain.com/web which points to your symfony /web directory. If you are going to change your settings in panel.dreamhost.com, you might as well make it point to
    ~/user/project/symfonyproject/web

    Cut the middle man, see what i’m sayin.

    THANK YOU FOR THE totorial, :) everything else works like a charm

    Sunday, September 9, 2007 at 11:49 am | Permalink
  13. Herself wrote:

    Chris B: Thanks! Glad you found it useful. :) I haven’t tried setting it up via SVN yet, but it shouldn’t be that hard, I would imagine. (And yeah, the wiki articles really aren’t very detailed. *g*)

    Mozey: Totally up to you. *g* (Although I suppose it could speed it up even a little tiny bit to do the direct link, but I’m not sure that the difference would be noticeable.) And you’re most welcome! Glad you found it useful. :)

    Monday, September 17, 2007 at 6:17 pm | Permalink
  14. Fropes wrote:

    This worked amazing for me as of today with Symfony 1.0.11. Thanks so much!

    Friday, March 14, 2008 at 9:16 am | Permalink
  15. Herself wrote:

    You’re welcome, Fropes! :)

    Friday, March 14, 2008 at 11:18 am | Permalink
  16. m y wrote:

    Thank you so much for this page! Worked like a charm :].

    Saturday, March 22, 2008 at 3:26 pm | Permalink
  17. Sam Pablo Kuper wrote:

    This is a really helpful walkthrough, thanks!

    However, once I’ve got to the end of it and go to the correct URL in my browser, I get the error “Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /home/.pig/sampablokuper/symfony_projects/symfonytest001/web/index.php on line 10″

    I’d be grateful for any advice you can give. Thanks again!

    Thursday, March 27, 2008 at 10:24 pm | Permalink
  18. Sam Pablo Kuper wrote:

    Apologies - in the dreamhost panel under domains > manage domains I had the PHP for that domain set to 4.4.x

    That’s why I was getting the error!

    Friday, March 28, 2008 at 2:10 am | Permalink
  19. josh wrote:

    [fresca]$ ln -s /home/xx/xyz/web /home/xx/xyz
    ln: `/home/xx/xyz/web’: cannot overwrite directory

    Wednesday, April 16, 2008 at 11:44 pm | Permalink
  20. I’ve never used PEAR, but as an alternative, I was able to use Subversion and Capistrano to handle deployment.

    http://vimeo.com/1048387

    Thursday, May 22, 2008 at 9:51 am | Permalink
  21. inakivb wrote:

    YEAH!!

    I was trying everything for hours, and finally, i came here…

    And it works!

    Thaks!

    Tuesday, May 27, 2008 at 9:31 am | Permalink
  22. Jon wrote:

    Hi, when i write:

    pear install symfony/symfony

    The result is:
    downloading symfony-1.1.1.tgz …
    Starting to download symfony-1.1.1.tgz (2,131,490 bytes)
    …….done: 2,131,490 bytes
    Killed

    And symfony dont install.

    Please, what can i do? Thanks!

    Sunday, September 14, 2008 at 8:40 am | Permalink
  23. Pro777 wrote:

    After banging my head trying to get Symfony configured properly on my Vista machine, this is an absolute Godsend! Thank yo so much.

    Sunday, December 28, 2008 at 1:31 pm | Permalink
  24. Flossy wrote:

    Just want to add to cacophony. This is an excellent tutorial that saved me what I assume would otherwise have been hours/days/weeks of digging for this information. Couldn’t have been more thorough and easy to comprehend. Cheers to your altruism.

    Tuesday, July 28, 2009 at 10:59 pm | Permalink
  25. Yon wrote:

    Amazingly well explained ;) THANKS

    Sunday, December 27, 2009 at 6:07 am | Permalink
  26. Guillermo wrote:

    Thank you very much!!! Your tutorial is very useful!!

    Wednesday, December 30, 2009 at 8:36 pm | Permalink
  27. Guillermo wrote:

    Hello!!
    I followed those steps and I could set my first symfony project on dreamhost.
    Then, I replace the server files with the files from my PC and my project is accessible now.
    The only problem is that images are broken.
    Could you help me please to fix the images problem?
    Thanks in advance.
    Guillermo

    Monday, January 4, 2010 at 9:09 pm | Permalink
  28. Guillermo wrote:

    Hi, I apologize for that but my mistake was the case sentive of linux. I am working on windows and I forgot that difference.
    Thanks!!
    Guillermo

    Monday, January 18, 2010 at 5:34 pm | Permalink

2 Trackbacks/Pingbacks

  1. Cognitive Conga » Blog Archive » Symfony on Dreamhost on Sunday, March 30, 2008 at 2:19 pm

    […] followed the instructions on Chatteren’s blog here, and they worked like a charm, although they omit to mention the need to ensure, on the Dreamhost […]

  2. Dreamhost did it again | Simpa studio blog on Saturday, March 21, 2009 at 3:18 pm

    […] you need to install symfony application on DreamHost I recommend Chatteren’s […]

Post a Comment

Your email is never published nor shared. Required fields are marked *
*
*