Posts tagged ‘symfony’

symfony upgrade to 1.1.1 failed

As Nicolas Perriault published on symfony’s blog the bugfix version 1.1.1 was released

I tried this upgrade procedure, but it failed:

pear upgrade symfony/symfony-1.1.1
downloading symfony-1.1.1.tgz ...
Starting to download symfony-1.1.1.tgz (2,131,490 bytes)
.................................................................................................................................................................................................................................................................................................................................................................done: 2,131,490 bytes

Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 82 bytes) in /usr/share/php/PEAR/Registry.php on line 1061

environment: Ubuntu
Linux 2.6.24-19-generic #1 SMP Fri Jul 11 21:01:46 UTC 2008 x86_64 GNU/Linux

*Update:*

fixed by setting memory_limit from default 32M to 128M in php.ini:
grep memory_limit /etc/php5/cli/php.ini
memory_limit = 128M ; Maximum amount of memory a script may consume (32MB)

Advertisements

Wednesday, 6 August 2008 at 13:40 UTC Leave a comment

Symfony 1.1 Admin Generator Install Cookbook at Ubuntu

Symfony is a full-stack framework, a library of cohesive classes written in PHP5.

It provides an architecture, components and tools for developers to build complex web applications faster. Choosing symfony allows you to release your applications earlier, host and scale them without problem, and maintain them over time with no surprise.
Symfony is based on experience. It does not reinvent the wheel: it uses most of the best practices of web development and integrates some great third-party libraries

1) install php-cli et al

* install necessary xsl transformator for PHP and php-cli

apt-get install php5-cli php5-xsl

* (optional) if you want to run the sf_sandbox example you the php sqlite extension:

apt-get install php5-sqlite

* depending on your planned database, install php mysql or postgres extension:

apt-get install php5-pgsql
apt-get install php5-mysql

2) install php pear – PHP Extension and Application Repository

from http://pear.php.net/ or under Ubuntu simple run

apt-get install php-pear

* upgrade pear to get most recent packages

sudo pear upgrade PEAR

3) install symfony with pear

see http://www.symfony-project.org/installation/1_1

* add symfony-project page to pear

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

* install the latest release symfony 1.1

sudo pear install symfony/symfony-1.1.1

4) check if symfony is installed correct

symfony -V
symfony version 1.1.1 (/usr/share/php/symfony)

php -v
PHP 5.2.4-2ubuntu5.3 with Suhosin-Patch 0.9.6.2 (cli) (built: Jul 23 2008 06:44:49)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies

5) apache config – add a virtual host

* pay attention to set the /sf alias, else your application will miss stylesheets (css etc.)
* to identify, which is your symfony/pear data directory

pear config-show

Configuration (channel pear.php.net):
=====================================
Auto-discover new Channels auto_discover
Default Channel default_channel pear.php.net
HTTP Proxy Server Address http_proxy
PEAR server [DEPRECATED] master_server pear.php.net
Default Channel Mirror preferred_mirror pear.php.net
Remote Configuration File remote_config
PEAR executables directory bin_dir /usr/bin
PEAR documentation directory doc_dir /usr/share/php/docs
PHP extension directory ext_dir /usr/lib/php5/20060613+lfs
PEAR directory php_dir /usr/share/php
PEAR Installer cache directory cache_dir /tmp/pear/cache
PEAR configuration file cfg_dir /usr/share/php/cfg
directory
PEAR data directory data_dir /usr/share/php/data
PEAR Installer download download_dir /tmp/pear/download
directory
PHP CLI/CGI binary php_bin /usr/bin/php
php.ini location php_ini
PEAR Installer temp directory temp_dir /tmp/pear/temp
PEAR test directory test_dir /usr/share/php/tests
PEAR www files directory www_dir /usr/share/php/www
Cache TimeToLive cache_ttl 3600
Preferred Package State preferred_state stable
Unix file mask umask 22
Debug Log Level verbose 1
PEAR password (for password
maintainers)
Signature Handling Program sig_bin /usr/bin/gpg
Signature Key Directory sig_keydir /usr/etc/pearkeys
Signature Key Id sig_keyid
Package Signature Type sig_type gpg
PEAR username (for username
maintainers)
User Configuration File Filename /home/thomas/.pearrc
System Configuration File Filename /usr/etc/pear.conf

cat /etc/apache2/sites-enabled/admintool

ServerAlias admintool

DocumentRoot /web
Alias /sf /usr/share/php/data/symfony/web/sf

apachectl graceful

6) unix group settings

* add user e.g. myuser to group www-data
* i needed this in my first sf_sandbox installation from scratch
/etc/group

* as i installed a new project and application with symfony this was no longer necessary

7) add a local name for apache

important, use 127.0.0.1 or add to your frontend_dev.php or appname_dev.php your different local IP
(symfony restricts to local access for all development files
)

/etc/hosts
127.0.0.1 localhost admintool

8) (optional) found a bug in original symfony sandbox archive

* this is only relevant for sandbox examples testing with sqlite
* aou need to modify config/propel.ini

propel.database.createUrl = sqlite://./../../../../data/sandbox.db
propel.database.url = sqlite://./../../../../data/sandbox.db

9) create the symfony project

mkdir admintool
cd admintool
symfony init-project admin

10) create the symfony application

symfony init-app adm

11) configure postgres database

config/database.yml

all:
propel:
class: sfPropelDatabase
param:
phptype: pgsql
host: localhost
database: DBNAME
username: DBUSER
password: DBPASSWORD

12) describe database schema model

*IMPORTANT! use spaces only, never use tabs, pay attention of similar ident

config/schema.yml

propel:
article:
id: ~
email: varchar(255)
created: timestamp
locale: varchar(255)
login: varchar(255)
password: varchar(255)
status: integer
product:
id: ~
comment: varchar(255)
created: timestamp
state: integer
title: varchar(255)

13) (optional) create sql and insert to an empty database

* if want to create a local database and filling test data

symfony propel:build-sql
symfony propel:insert-sql
php batch/load_data.php

14) building the model from given schema.yml definition

symfony propel:build-model

15) generate the application based on generated model classes

* one for each table

symfony propel:init-admin adm article Article
symfony propel:init-admin adm product Product

16) test the first application

* http://admintool/adm_dev.php/product

If you make any modifications on the model or add plugin etc. run clear-cache task (cc)

symfony propel:clear-cache

Other Resources:

* The Symfony Framework Homepage
* Symfony 1.0 Tutorial Extending Admin Generator from Par COil at strangebuzz (April 2008)
* A Symfony Beginner’s Tutorial from Francois Zaninotto at sitepoint (April 2007)

Monday, 28 July 2008 at 23:08 UTC 2 comments


Categories