Herramientas de usuario

Herramientas del sitio


notas:symfony

Primeras experiencias con symfony

(Esta página fue creada en el wiki 2007/07/17; movida a esta ubicación 2009/05/06.)

Instalación

En casa: Ubuntu Dapper. Instalé php5 y pear.

fer@fer-desktop:~$ sudo pear channel-discover pear.symfony-project.com
Password:
Adding Channel "pear.symfony-project.com" succeeded
Discovery of channel "pear.symfony-project.com" succeeded
fer@fer-desktop:~$ pear install symfony/symfony
downloading symfony-1.0.5.tgz ...
Starting to download symfony-1.0.5.tgz (1,904,858 bytes)
......done: 1,904,858 bytes
ERROR: failed to mkdir /usr/share/php/symfony
fer@fer-desktop:~$ sudo pear install symfony/symfony
downloading symfony-1.0.5.tgz ...
Starting to download symfony-1.0.5.tgz (1,904,858 bytes)
.................................................................................................
.................................................................................................
.................................................................................................
.....................................................................................done: 1,904, 858 bytes

Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 8192 bytes) in /usr/share/php/PEAR/Installer.php on line 520

Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 35 bytes) in /usr/share/php/System.php on line 133

De acuerdo a lo sugerido en

http://www.symfony-project.com/forum/index.php/m/31334/

modifiqué el archivo php.ini:

memory_limit = 32M      ; Maximum amount of memory a script may consume (8MB)

y reinicié apache (verifico con phpinfo() que el nuevo valor fue tomado). Sin embargo, sigo recibiendo el error

Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 8192 bytes) in /usr/share/php/PEAR/Installer.php on line 520

Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 16 bytes) in /usr/share/php/System.php on line 131

Intento con “Linux installation”, según http://www.symfony-project.com/content/download.html

fer@fer-desktop:~$ wget http://www.symfony-project.com/get/debian/php5-symfony_1.0.5_all.deb
--10:34:58--  http://www.symfony-project.com/get/debian/php5-symfony_1.0.5_all.deb
           => `php5-symfony_1.0.5_all.deb'
Resolving www.symfony-project.com... 212.43.221.177
Connecting to www.symfony-project.com|212.43.221.177|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2,803,168 (2.7M) [text/plain]

100%[=========================================================================>] 2,803,168     57.76K/s    ETA 00:00

10:35:53 (50.38 KB/s) - `php5-symfony_1.0.5_all.deb' saved [2803168/2803168]
fer@fer-desktop:~$ sudo dpkg -i php5-symfony_1.0.5_all.deb
Selecting previously deselected package php5-symfony.
(Reading database ... 88946 files and directories currently installed.)
Unpacking php5-symfony (from php5-symfony_1.0.5_all.deb) ...
Setting up php5-symfony (1.0.5) ...
fer@fer-desktop:~$ symfony -V
symfony version 1.0.5

Instalación en INMABB

Sistema operativo: Ubuntu Dapper.

Versión de PHP:

fer@fgomez03:~$ php -v
PHP 5.1.2 (cli) (built: May 22 2007 20:23:21)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies

Voy a seguir los pasos de http://www.symfony-project.com/askeet/1

pear no está disponible, lo instalo usando synaptic.

Luego intento actualizar pear, pero olvido usar sudo:

fer@fgomez03:~$ pear upgrade PEAR
Did not download optional dependencies: pear/XML_RPC, use --alldeps to download automatically
pear/PEAR can optionally use package "pear/XML_RPC" (version >= 1.4.0)
downloading PEAR-1.6.1.tgz ...
Starting to download PEAR-1.6.1.tgz (295,780 bytes)
........done: 295,780 bytes
downloading Archive_Tar-1.3.2.tgz ...
Starting to download Archive_Tar-1.3.2.tgz (17,150 bytes)
...done: 17,150 bytes
downloading Structures_Graph-1.0.2.tgz ...
Starting to download Structures_Graph-1.0.2.tgz (30,947 bytes)
...done: 30,947 bytes
downloading Console_Getopt-1.2.3.tgz ...
Starting to download Console_Getopt-1.2.3.tgz (4,011 bytes)
...done: 4,011 bytes
ERROR: failed to write /usr/share/php/Console/.tmpGetopt.php
ERROR: failed to mkdir /usr/share/php/docs/Structures_Graph/docs/html/media
ERROR: failed to write /usr/share/php/Archive/.tmpTar.php
ERROR: failed to create /usr/share/php/OS/.tmpGuess.php: failed to open stream: Permission denied

Ahora uso sudo:

fer@fgomez03:~$ sudo pear upgrade PEAR
Password:
Did not download optional dependencies: pear/XML_RPC, use --alldeps to download automatically
pear/PEAR can optionally use package "pear/XML_RPC" (version >= 1.4.0)
downloading PEAR-1.6.1.tgz ...
Starting to download PEAR-1.6.1.tgz (295,780 bytes)
..............................done: 295,780 bytes
downloading Archive_Tar-1.3.2.tgz ...
Starting to download Archive_Tar-1.3.2.tgz (17,150 bytes)
...done: 17,150 bytes
downloading Structures_Graph-1.0.2.tgz ...
Starting to download Structures_Graph-1.0.2.tgz (30,947 bytes)
...done: 30,947 bytes
downloading Console_Getopt-1.2.3.tgz ...
Starting to download Console_Getopt-1.2.3.tgz (4,011 bytes)
...done: 4,011 bytes
upgrade ok: channel://pear.php.net/Console_Getopt-1.2.3
upgrade ok: channel://pear.php.net/Structures_Graph-1.0.2
upgrade ok: channel://pear.php.net/Archive_Tar-1.3.2
upgrade ok: channel://pear.php.net/PEAR-1.6.1
PEAR: Optional feature webinstaller available (PEAR's web-based installer)
PEAR: Optional feature gtkinstaller available (PEAR's PHP-GTK-based installer)
PEAR: Optional feature gtk2installer available (PEAR's PHP-GTK2-based installer)
To install use "pear install PEAR#featurename"
fer@fgomez03:~$

Añado el canal 'symfony':

fer@fgomez03:~$ sudo pear channel-discover pear.symfony-project.com
Adding Channel "pear.symfony-project.com" succeeded
Discovery of channel "pear.symfony-project.com" succeeded

Intento instalar symfony:

fer@fgomez03:~$ sudo pear install symfony/symfony-beta
downloading symfony-1.0.5.tgz ...
Starting to download symfony-1.0.5.tgz (1,904,858 bytes)
.......done: 1,904,858 bytes

Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 74 bytes) in /usr/share/php/PEAR/PackageFile/v2/Validator.php on line 1026
Allowed memory size of 8388608 bytes exhausted (tried to allocate 40 bytes)
fer@fgomez03:~$

Con la instalación de phing tengo más suerte:

fer@fgomez03:~$ sudo pear install http://phing.info/pear/phing-current.tgz
Password:
downloading phing-current.tgz ...
Starting to download phing-current.tgz (361,527 bytes)
....done: 361,527 bytes
Did not download dependencies: pear/VersionControl_SVN, pear/PHPUnit2, pear/PhpDocumentor, pecl/Xdebug, pear/PEAR_PackageFileManager, use --alldeps or --onlyreqdeps to download automatically
pear/phing can optionally use package "pear/VersionControl_SVN" (version >= 0.3.0alpha1)
pear/phing can optionally use package "pear/PHPUnit2" (version >= 2.2.0)
pear/phing can optionally use package "pear/PhpDocumentor" (version >= 1.3.0RC3)
pear/phing can optionally use package "pear/Xdebug" (version >= 2.0.0beta2)
pear/phing can optionally use package "pear/PEAR_PackageFileManager" (version >= 1.5.2)
install ok: channel://pear.php.net/phing-2.1.1

Entro en IRC al canal #symfony (gracias lanmaster por permitir el acceso), pido ayuda y se me enciende la lamparita: tengo que modificar los dos archivos php.ini, no solamente el usado por apache:

/etc/php5/apache2/php.ini
/etc/php5/cli/php.ini

En ambos subo el límite de memoria:

memory_limit = 32M      ; Maximum amount of memory a script may consume (8MB)

Para que entre en efecto el cambio en /etc/php5/apache2/php.ini, reinicio el apache (aunque no parece necesario para la instalación con pear, [MA]Pascal sugiere modificar ambos php.ini):

fer@fgomez03:~$ sudo apache2ctl restart
apache2: Could not determine the server's fully qualified domain name, using 127.0.0.1 for ServerName

La instalación ahora funciona OK:

fer@fgomez03:~$ sudo pear install symfony/symfony-beta
downloading symfony-1.0.5.tgz ...
Starting to download symfony-1.0.5.tgz (1,904,858 bytes)
..................done: 1,904,858 bytes
install ok: channel://pear.symfony-project.com/symfony-1.0.5

fer@fgomez03:~$ symfony -V
symfony version 1.0.5

El project setup no presenta problemas.

Pero se me complica el setup del servidor web, entre el virtual host y el archivo /etc/hosts… algo no anda bien.

Para poder seguir adelante, creo un link simbólico

cd /home/fer/www/html
ln -s /home/fer/sfprojects/askeet/web/ askeet

y accedo desde

http://127.0.0.1/askeet/

y

http://127.0.0.1/askeet/frontend_dev.php/

Pero además modifiqué la configuración de apache:

sudo vi /etc/apache2/sites-available/default

para agregar esta línea:

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

(eso es necesario para acceder a archivos css y js).

SVN

Seguí todos los pasos sin encontrar problemas. Definí la variable SVNREP_DIR=/home/fer/svn

En conclusión, askeet está presente en estos 3 lugares:

fer@fgomez03:~$ ll www/html/askeet
lrwxrwxrwx 1 fer fer 32 2007-07-17 16:08 www/html/askeet -> /home/fer/sfprojects/askeet/web/
fer@fgomez03:~$ ll sfprojects/
total 4
drwxr-xr-x 14 fer fer 4096 2007-07-17 18:35 askeet
fer@fgomez03:~$ ll svn/
total 4
drwxr-xr-x 7 fer fer 4096 2007-07-17 18:27 askeet

symfony

notas/symfony.txt · Última modificación: por 127.0.0.1