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 usernameprojects_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.comand viewed on the web athttp://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 fontis 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,lnandrm.
Ok, on with the instructions. :)
- Install a custom pear installation on your account (instructions adapted from here).
- Log in to your shell account and issue the following commands in your home directory (
/home/username):$ pear config-create $HOME .pearrc$ pear config-set download_dir /home/username/tmp/pear/cache$ pear config-set cache_dir /home/username/tmp/pear/cache$ pear config-set temp_dir /home/username/tmp/pear/temp$ pear install -o PEAR$ export PHP_PEAR_PHP_BIN=/usr/local/php5/bin/php$ 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_profilein your home directory.)
- Check to make sure everything worked:
$ which phpshould answer/usr/local/php5/bin/php.$ php -vshould answer that the version is >= 5.0. (Necessary because symfony is written for PHP ver. 5+)$ which pearshould answer/home/username/pear/pear.$ pear -Vshould 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.)
- Log in to your shell account and issue the following commands in your home directory (
- Install symfony (instructions summarized from here):
- Tell pear to find the symfony project’s channel:
$ pear channel-discover pear.symfony-project.com - List the projects available for download from this channel (symfony should be listed in the results):
$ pear remote-list -c symfony - Tell pear to install symfony from the symfony channel:
$ pear install symfony/symfony - Check what version of symfony is now installed:
$ symfony -Vshould answer something likesymfony version 1.0.5.
- Tell pear to find the symfony project’s channel:
- Create a directory to store your projects in, above the web accessible domain directories (
/home/username/projects_directory):$ mkdir projects_directory - Create your project and application(s). In the projects_directory:
- Create a directory for your project:
$ mkdir project_name - Change directories to the one you just created:
$ cd project_name - Tell symfony to create the project:
$ symfony init-project project_name - 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/ - Create the application:
$ symfony init-app app_name. That creates aapp_name/directory in theapps/folder of the project root.
- Create a directory for your project:
- Create symbolic links (adapted from here):
- 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 - 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 - 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 atexample.com/web, rather than at the top level ofexample.com. To fix that, go to theDreamHost control panel -> domains -> manage domains. Edit the web directory for the domain from/home/username/example.comto/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).
- This link tells the server where the symfony images, CSS files, etc., are for the administration pages (type this all on one line):
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
23 Comments
I just come across this tutorial.
Excellent, this is exactly what I was looking for.
Thanks.
You’re most welcome, Simone. Glad you found it of use! :)
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 !
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 !!
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
Please never take this info down. It works like a charm.
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
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.
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. :)
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.)
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?
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
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. :)
This worked amazing for me as of today with Symfony 1.0.11. Thanks so much!
You’re welcome, Fropes! :)
Thank you so much for this page! Worked like a charm :].
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!
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!
[fresca]$ ln -s /home/xx/xyz/web /home/xx/xyz
ln: `/home/xx/xyz/web’: cannot overwrite directory
I’ve never used PEAR, but as an alternative, I was able to use Subversion and Capistrano to handle deployment.
http://vimeo.com/1048387
YEAH!!
I was trying everything for hours, and finally, i came here…
And it works!
Thaks!
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!
After banging my head trying to get Symfony configured properly on my Vista machine, this is an absolute Godsend! Thank yo so much.
2 Trackbacks/Pingbacks
[…] 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 […]
[…] you need to install symfony application on DreamHost I recommend Chatteren’s […]
Post a Comment