Search This Blog

Wednesday, January 30, 2013

Installing PHP extensions.

When using php, it won't be long before you will need to install an extension.
An example is with Symfony2 which recommends APC and intl extensions.
In fact intl is required for the FOSUserBundle, if intl is not installed you will get the error: The locale resource bundle could not be loaded for locale "en"
when trying to edit a user profile (e.g. ../../user/user/1/edit)

Use pecl to install the intl extension and then add a:
extenions=intl.so
to /etc/php.ini.

When doing this you might get the following errors:
[root@spectest php-5.3.4]# pecl install intl
downloading intl-2.0.1.tgz ...
Starting to download intl-2.0.1.tgz (149,430 bytes)
.................................done: 149,430 bytes
package.xml version "2.1" is not supported, only 1.0 and 2.0 are supported.
Download of "pecl/intl" succeeded, but it is not a valid package archive
Error: cannot download "pecl/intl"
In this case, upgrade pear, you might need to enter:
 pear upgrade -f pear


Note - intl requires libicu. Either download it from site.icu-project.org, or through your package installed (e.g.: yum  - package libicu-devel), if using yum it will most likely require icu and libicu as prerequisites.

No comments:

Post a Comment