Installing symfony on Vista

by John McGeechan

Symfony logoSynopsis

Instructions for setting up Symfony on your local machine can at first seem  baffling.With the benefit of hindsight however, the install instructions are actually fairly straightforward. However the initial install does not produce the congratulations  screen as described in the manual (see congratulations screen) and in my case led to a wild goose chase as I assumed that the install had failed. It took several hours of retrying before realizing that a small tweak is required (more on this later)

 Assumptions

This article covers a purely Windows Vista installation and assumes that  XAMPP or at least apache is installed on the local machine. These instructions may work for other combos, but just to be clear, here's the full set-up...

PHP

 5.2.6

Server API

Apache 2.0 Handler 

WIndows

Vista

Installation

Download package

According to the 'Choice Matrix' in the official symfony documentation I needed to download  symfony 1.2 for my version of PHP. They recommend two methods, either via a PEAR install or directly from the svn repository. I decided on the pear install. I followed the instructions in the manual as stated here..

Open a new command prompt window and...

Type in the command line:

$ pear channel-discover pear.symfony-project.com

Then, to install the latest 1.2 release:

$ pear install symfony/symfony-1.2.4

 So far so good, the module is now installed in ~/php/PEAR/symfony

Include symfony on execution path

The next step is to change the system path variable to ensure that it includes the path to the symfony binary

Click Start Orb > right click on computer > select  Properties > Advanced system settings >  Environment variables

If the system variable 'Path' does not exist then create it (use 'New') otherwise add to the existing path the value...

~/php/PEAR/symfony/data/bin

 save and quit

 Create test project

 The next step is to create a test project, for ease I create mine under the htdocs of xampp, so that I know it will appear immediately without having to create any unnecessary apache aliases. Again open a command prompt window

create the new directory

cd ~/xampp/htdocs

mkdir testProject

chdir testProject

Then generate the project, note that you can run symfony commands now as the symfony binary is on the system path variable (previous step) 

symfony generate:project testProject

Then create the new application 'frontend' (or whatever) 

symfony generate:app frontend

Test new project

Open a new browser and point to localhost/testProject. This should display a default congratulations message, in all likelyhood this page will not be nicely formatted. The reason being that generate:project does not create the styles and images needed in order to pretify this page. This threw me for a long time as I assumed the install had not worked properly. As it turns out these files do exist but in the PEAR install, they are simply not duplicated for each project (which is sensible), also they may be out of date when the PEAR packages are upgraded. The final step therefore is to create an alias on the apache conf to ensure that the files are accessible...

Create Apache alias for symfony system files

Add the following lines to the apache config file

Alias /testProject/sf "~/php/PEAR/symfony/data/web/sf/"
<Directory "~/php/PEAR/symfony/data/web/sf/">
Options Indexes MultiViews
     AllowOverride None
     Order allow,deny
     Allow from all
</Directory>

* Note '~' should be replaced by the full path  

 In the event that your project is not on the ~/xampp/htdocs path and you have instead made a separate alias for it in the config, ensure that alias is defined after the /sf alias detailed above

 

 

 

 

 

 

.

That's a gotcha alright

Thanks for this. I also got thrown by the images not being displayed. Like you said , it makes sense, but a note about it wouldn't kill 'em.

Thanks for this.

Post new comment

By submitting this form, you accept the Mollom privacy policy.