Tuesday 25 November 2008

Installing symfony - setting up the virtual host

Well, here is another thing that I have learned using symfony.

The basic installation tutorial instructs you to set up a virtual host for symfony:

<VirtualHost *:80>
ServerName myapp.example.com
DocumentRoot "/home/steve/myproject/web"
DirectoryIndex index.php
Alias /sf /$sf_symfony_data_dir/web/sf
<Directory "/$sf_symfony_data_dir/web/sf">
AllowOverride All
Allow from All
</Directory>
<Directory "/home/steve/myproject/web">
AllowOverride All
Allow from All
</Directory>
</VirtualHost>


This was all new to me, so I set up "all" the paths correctly, and found that while it did allow me to use my symfony application properly and all the data_dir links where effectively aliased as planned, it also broke my other "localhost" links (e.g. I could no longer access http://localhost/other_app). Ouch.

Now I have figured out why: I hadn't changed the ServerName. So, the issue was solved by simply creating a new ServerName like so:

ServerName symfonyappname.localhost


To get this working the operating system must also be configured accordingly. To do this, simply add an entry to your hosts file, the location of which depends on which OS you are using.

Check out this link to find out where your hosts file is located.

Once the hosts file is properly configured (remember you may need to reboot), simply type:

http://symfonyappname.localhost

and magic happens :).

Thoughts?

No comments:

Online Marketing
Add blog to our blog directory blog search directory Blog Directory Blogarama - The Blog Directory