symfony2

Symfony2 Exception – DateTime::__construct(): It is not safe to rely on the system’s timezone settings.

Dando os primeiros passos com o Symfony2, acabei batendo de frente com um erro que provavelmente veio da configuração do MAMP.

DateTime::__construct(): It is not safe to rely on the system’s timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected ‘America/Sao_Paulo’ for ‘BRT/-3.0/no DST’ instead

O php que eu estou chamando fica no /usr/bin/php.

Para solucionar o problema eu passei o arquivo de configuração pela linha de comando.

$ php -c /Applications/MAMP/bin/php/php5.3.6/conf/ app/console
Symfony version 2.0.0 – app/dev/debug
Usage:
  [options] command [arguments]
(...)

Criei um alias para melhorar mais ainda:

$ alias sf2=“php -c /Applications/MAMP/bin/php/php5.3.6/conf/”
$ sf2 app/console
Symfony version 2.0.0 – app/dev/debug
Usage:
  [options] command [arguments]
(...)

php
symfony2

Comments (0)

Permalink

Compilando e instalando a extensão intl no OS X 10.6.8 – Symfony2

Um dos requisitos da instalação do Symfony2 é a extensão intl.so do PHP.
Vou mostrar aqui todos os passos que executei para compilar e instalar.

$ uname -a
Darwin pedrocasado.local 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun 7 16:32:41 PDT 2011; root:xnu-1504.15.3~1/RELEASE_X86_64 ×86_64

1 – Fiz o download do MAMP 2.0 e instalei.

2 – É necessário termos instalado uma lib chamada ICU. Suponho que você já tenha o MacPorts instalado para efetuar esse próximo passo:

$ sudo port install icu
Password:
—-> Fetching archive for icu
—-> Attempting to fetch icu-4.6.1_0.darwin_10.x86_64.tbz2 from http://packages.macports.org/icu
—-> Attempting to fetch icu-4.6.1_0.darwin_10.x86_64.tbz2.rmd160 from http://packages.macports.org/icu
—-> Installing icu 4.6.1_0<br /> ---> Activating icu 4.6.1_0
—-> Cleaning icu
$ icu-config
usage: icu-config [ —noverify ] [ —bindir ] [ —cc ] [ —cflags ] [ —cflags-dynamic ] [ ] [ —cppflags ] [ —cppflags-dynamic ] [ ] [ —cppflags-searchpath ] [ —cxx ] [ —cxxflags ] [ —cxxflags-dynamic ] [ ] [ —detect-prefix ] [ —exec-prefix ] [ —exists ] [ —help, -?, —usage ] [ —icudata ] [ —icudata-install-dir ] [ —icudata-mode ] [ —icudatadir ] [ —invoke ] [ —invoke= ] [ —ldflags ] [ —ldflags-layout ] [ —ldflags-libsonly ] [ —ldflags-searchpath ] [ —ldflags-system ] [ —ldflags-icuio ] [ —ldflags-obsolete ] [ —mandir ] [ —prefix ] [ —prefix=XXX ] [ —sbindir ] [ —shared-datadir ] [ —shlib-c ] [ —shlib-cc ] [ —sysconfdir ] [ —unicode-version ] [ —version ] [ —incfile ] [ —incpkgdatafile ] [ —install ] [ —mkinstalldirs ]
$

Você terá problemas se efetuar os próximos passos sem ter o ICU instalado: configure: error: Unable to detect ICU prefix or /usr/bin/icu-config failed. Please verify ICU install prefix and make sure icu-config works.

3 – Vá até o diretório /Applications/XAMPP/xamppfiles/lib/php/php-5.3.4/ext/intl e execute os comandos abaixo:


$ cd /Applications/XAMPP//xamppfiles/lib/php/php-5.3.4/ext/intl
$ phpize
Configuring for:
PHP Api Version: 20090626
Zend Module Api No: 20090626
Zend Extension Api No: 220090626

$ ./configure —enable-intl
checking for grep that handles long lines and -e… /usr/bin/grep
checking for egrep… /usr/bin/grep -E
checking for a sed that does not truncate output… /usr/bin/sed
checking for cc… cc
checking for C compiler default output file name… a.out
(…)
checking for icu-config… /opt/local/bin/icu-config
checking for location of ICU headers and libraries… /opt/local
checking for ICU 3.4 or greater… found 4.6.1
checking for g++… g++
(…)
configure: creating ./config.status
config.status: creating config.h

$ make test
(…)

4 – Agora vamos compilar e copiar a extensão para o diretório do MAMP.

$ sudo make install
Installing shared extensions: /usr/lib/php/extensions/no-debug-non-zts-20090626/
$ ls -l /usr/lib/php/extensions/no-debug-non-zts-20090626/
total 480
-rwxr-xr-x 1 root wheel 223864 Aug 6 16:13 intl.so
$ cp /usr/lib/php/extensions/no-debug-non-zts-20090626/intl.so /Applications/MAMP/bin/php/php5.3.6/lib/php/extensions/no-debug-non-zts-20090626/
$

5 – Sua extensão já está compilada e pronta para ser utilizada. Vamos adicionar a linha extension=intl.so no php.ini:

$ echo ‘extension=intl.so’ >> /Applications/MAMP//bin/php/php5.3.6/conf/php.ini

Estou disponibilizando aqui o link do intl.so caso alguém queira tentar utilizar.

É isso ai.
Valeu!

php
symfony2

Comments (0)

Permalink