This page describes how to build a Symfony site in your CSE home directory.
You'll need these things to complete this project:
- An account on the CSE development web server, cheshire.
- A MySQL account (optional).
- Install. Download and install the latest Symfony Standard *.tgz source code somewhere beneath your public_html directory. I've chosen to install mine in my ~/public_html/waf/ subdirectory (where I'm putting all of my Web Application Framework (WAF) installations):
[cheshire] % cd ~/public_html/waf/
[cheshire] waf% cp /tmp/Symfony_Standard_Vendors_2.0.15.tgz .
[cheshire] waf% gunzip Symfony_Standard_Vendors_2.0.15.tgz
[cheshire] waf% tar -xvf Symfony_Standard_Vendors_2.0.15.tar
[cheshire] waf% rm Symfony_Standard_Vendors_2.0.15.tar
At the end of this step, you should have a Symfony directory in your installation location.
- Test Requirements. Make sure your server supports Symfony's mandatory requirements:
[cheshire] waf% php Symfony/app/check.php
- Configure. You can't use the web configuration tool yet. Trying to run it:
http://www-student.cse.buffalo.edu/~userid/waf/Symfony/web/config.php
... gives you:
This script is only accessible from localhost.
One way around this problem is to look up the IP address of your local host, then add that IP address to this block of code at the top of Symfony/web/config.php:
if (!in_array(@$_SERVER['REMOTE_ADDR'], array(
'127.0.0.1',
'128.205.34.190',
'::1',
))) {
header('HTTP/1.0 403 Forbidden');
exit('This script is only accessible from localhost.');
}
Now when you run the web configuration tool, it should work.
You'll also need to make this fix to Symfony/web/app_dev.php later on, so you may as well do that now, too.
- Change the Cache and Logs Directory Locations.. When you run the web tool, you'll see this error:
2 Major problems
Major problems have been detected and must be fixed before continuing :
Change the permissions of the "app/cache/" directory so that the web server can write into it.
Change the permissions of the "app/logs/" directory so that the web server can write into it.
It's generally a bad idea to make anything in your personal web space world-writeable because that just invites malicious people to interfere with your code. So we'll redefine the cache and logs locations so the user that the Apache httpd processes run as (www) can write to them.
/var is an appropriate local filesystem to house them. Because this is a local filesystem, make sure you create them on cheshire and not some other server.
[cheshire] % mkdir /var/symfony/userid/cache
[cheshire] % mkdir /var/symfony/userid/logs
[cheshire] % chmod 777 /var/symfony/userid/cache/
[cheshire] % chmod 777 /var/symfony/userid/logs/
Add the following methods to Symfony/app/AppKernel.php (AppKernel extends Kernel) making them return your preferred paths:
public function getCacheDir()
{
return '/var/symfony/userid/cache/';
}
public function getLogDir()
{
return '/var/symfony/userid/logs';
}
Hack the Symfony/web/config.php to get past the hard-coded cache and logs writeability error:
// if (!is_writable(__DIR__ . '/../app/cache')) {
if (!is_writable('/var/symfony/userid/cache')) {
$majorProblems[] = 'Change the permissions of the "app/cache/"
directory so that the web server can write into it.';
}
// if (!is_writable(__DIR__ . '/../app/logs')) {
if (!is_writable('/var/symfony/userid/logs')) {
$majorProblems[] = 'Change the permissions of the "app/logs/"
directory so that the web server can write into it.';
}
Refresh the page and you should see more links with which you may configure your site.
- http://symfony.com/download
- http://stackoverflow.com/questions/7357120/changing-cache-dir-and-log-di...