I have been working with PHP for about a year, prior to that using the .NET platform. I liked the flexibility of the PHP language and its closeness to working with the structures of the web, but also missed some of the framework and DAL/MVC aspects I was used to in .NET. Having read about frameworks for PHP I decided to install Symfony.
Being new to Apache servers as well, it was quite a task to try and get things installed.
Step 1.
Download latest copy of Symfony
I installed the copy of Symfony in a shared folder on my linux server. If you are going to use Symfony for a number of projects then it is better to have one copy of the shared files rather than many of them sitting on the server. I have seen a number of different paths suggested for this:
/usr/local/lib/php/data/symfony
/usr/local/siwapp/lib/vendor/symfony
/home/sfproject/lib/vendor/symfony
I went with /usr/local/lib/php/data/symfony. I can’t remember why now, but that’s the folder it got installed to.
Setting up a Symlink from my web directory to the shared Symfony directory.
There was a lot of documentation about how to edit the httpd.conf files and include a Virtual Host (better than using Alias) to allow access to the shared Symfony folder, but the latest version of Apache and WHM/Cpanel overwrite the base httpd.conf file each time Apache is reconfigured. (I realized later there is a way to include extra httpd.conf through the WHM panel, by clicking Service Configuration -> Include Editor and then choosing one of the places to include text that will get merged later).
WHM configure httpd
My choice here instead was to create a Symlink. Here is how to do it
Go to the folder that you want to create a subfolder for a virtual symlink hookup, then write the command to make a symlink as follows:
cd /home/websitename/public_html
ln -s /usr/local/lib/php/data/symfony/web/sf/ sf
You can see I referenced the shared folder discussed before, and this time called it all the way to the sub-folder “sf”. I then named my virtual symlink folder in the local web directory as “sf”. To check this type
ls -l
and see the newly created “sf” virtual folder will point to the Symfony shared folder
Creating Symlinks
These sites were very useful
http://www.weblincs.co.uk/symfony-framework-cPanel-shared-hosting.html
http://librosweb.es/symfony_1_2_en/capitulo3/configuring_the_web_server.html
http://www.cpanel.net/documentation/easyapache/customdirectives.html#vhost