Problems installing Symfony 2.4.1 lib-icu 4.4 dependency - php

I'm having a problem identical to this one, but the solution provided there isn't working for me.
I downloaded the Symfony 2.4.1 Standard Vendors with Vendors package from the Symfony Downloads Page. After extracting the files and downloading composer.phar, I run php composer.phar install and get this error:
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Your requirements could not be resolved to an installable set of packages.
Problem 1
- symfony/icu v1.2.0 requires lib-icu >=4.4 -> the requested linked library icu has the wrong version installed or is missing from your system, make sure to have the extension providing it.
- symfony/icu v1.2.0 requires lib-icu >=4.4 -> the requested linked library icu has the wrong version installed or is missing from your system, make sure to have the extension providing it.
- Installation request for symfony/icu v1.2.0 -> satisfiable by symfony/icu[v1.2.0].
Following the instructions on the thread linked to above, I updated PEAR libraries and did sudo pear install pecl/intl. (This is on CentOS so I didn't follow the MAMP stuff). This didn't work and I realized I had to do a sudo yum install libicu. After this, sudo pear install pecl/intl worked, and I edited php.ini to add the extension=intl.so line and then restarted the Apache server.
But I'm still getting the same error as above, and in addition, any time I run PHP it gives the warning:
PHP Warning: Module 'intl' already loaded in Unknown on line 0
Looking at the output of phpinfo() I see that the installed intl version is 1.1.0, and the ICU version is 4.2.1 (which explains why Symfony is complaining that it needs 4.4). But when I do /usr/bin/pecl install intl it says
pecl/intl is already installed and is the same as the released version 3.0.0
And the sudo yum install libicu should have installed the latest version.
Is there any way to get the 4.4 version?

For your specific situation, you should specify in your composer.json file that you want to use "symfony/icu": "1.1.*"
See the "ICU and Deployment Problems" section of this page: https://symfony.com/doc/2.4/components/intl.html

you are editing the wrong php.ini file
run this command in console :
php -i | grep php.ini
Configuration File (php.ini) Path => /etc/php5/cli
Loaded Configuration File => /etc/php5/cli/php.ini
edit that file. ( it's the php cli file )

Related

Dealing with "the requested PHP extension pdo_sqlite is missing from your system. " when running composer install

I'm having difficulty running composer install on Jenkins.
I have a Jenkins job that I need to run composer install for. I have installed php7.2 and composer. When I run the command, I get the following errors:
composer install
Problem 1
- teamtnt/tntsearch v1.3.2 requires ext-pdo_sqlite * -> the requested PHP extension pdo_sqlite is missing from your system.
- teamtnt/tntsearch v1.3.2 requires ext-pdo_sqlite * -> the requested PHP extension pdo_sqlite is missing from your system.
- Installation request for teamtnt/tntsearch v1.3.2 -> satisfiable by teamtnt/tntsearch[v1.3.2].
So I install sqlite using the following command: sudo apt-get install php7.2-sqlite3
After this, I get the additional warning, and the error persists.
PHP Warning: PHP Startup: Unable to load dynamic library 'pdo_sqlite.so'
(tried: /usr/lib/php/20170718/pdo_sqlite.so (/usr/lib/php/20170718/pdo_sqlite.so:
undefined symbol: sqlite3_column_table_name), /usr/lib/php/20170718/pdo_sqlite.so.so
(/usr/lib/php/20170718/pdo_sqlite.so.so: cannot open shared object file:
No such file or directory)) in Unknown on line 0
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Your requirements could not be resolved to an installable set of packages.
Problem 1
- teamtnt/tntsearch v1.3.2 requires ext-pdo_sqlite * -> the requested PHP extension pdo_sqlite is missing from your system.
- teamtnt/tntsearch v1.3.2 requires ext-pdo_sqlite * -> the requested PHP extension pdo_sqlite is missing from your system.
- Installation request for teamtnt/tntsearch v1.3.2 -> satisfiable by teamtnt/tntsearch[v1.3.2].
When I ssh into the Jenkins box and run composer install from the workspace directory, everything runs as expected and the vendor directory is generated with no errors.
I have spent a lot of time looking at the answers to existing questions on StackOverflow.
I've purged everything that is not php7.2, and removed any previous versions of my machine.
I have also installed the php7.2-pdo_sqlite, and ensured that it is displayed in the php.ini file.
I've also tried completely removing php (and checked using php -v) and then reinstalled php7.2.
When I run php --ini I see /etc/php/7.2/cli/conf.d/20-pdo_mysql.ini, and
/etc/php/7.2/cli/conf.d/20-pdo_sqlite.ini displayed on the list.
I have also given READ permissions to /usr/lib/php/20170718/pdo_sqlite.so incase it was due to a permission error.
What else can I do to resolve the error above? - my goal is to be able to run composer install.
Workaround
If your build pipeline doesn't require sqlite to be installed, you can bypass the check for platform requirements with --ignore-platform-reqs, like so:
composer install --ignore-platform-reqs
From the documentation:
--ignore-platform-reqs: ignore php, hhvm, lib-* and ext-* requirements and force the installation even if the local machine does not fulfill
these. See also the platform config option.
If you have tests that assert sqlite functionality, this isn't a solution, unfortunately.

Magento 2 Issue with composer

I face below issue when trying to run composer install:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/Cellar/php70/7.0.14_7/lib/php/extensions/no-debug-non-zts-20151012/php_intl.dll' - dlopen(/usr/local/Cellar/php70/7.0.14_7/lib/php/extensions/no-debug-non-zts-20151012/php_intl.dll, 9): image not found in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library '/usr/local/Cellar/php70/7.0.14_7/lib/php/extensions/no-debug-non-zts-20151012/php_intl.dll' - dlopen(/usr/local/Cellar/php70/7.0.14_7/lib/php/extensions/no-debug-non-zts-20151012/php_intl.dll, 9): image not found in Unknown on line 0
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them.
Your requirements could not be resolved to an installable set of packages.
Problem 1
Installation request for magento/magento2-base 2.1.1 -> satisfiable by magento/magento2-base[2.1.1].
magento/magento2-base 2.1.1 requires ext-intl * -> the requested PHP extension intl is missing from your system.
Problem 2
Installation request for magento/product-community-edition 2.1.1 -> satisfiable by magento/product-community-edition[2.1.1].
magento/product-community-edition 2.1.1 requires ext-intl * -> the requested PHP extension intl is missing from your system.
To enable extensions, verify that they are enabled in those .ini files:
- /usr/local/etc/php/7.0/php.ini
- /usr/local/etc/php/7.0/conf.d/ext-mcrypt.ini
You can also run php --ini inside terminal to see which files are used by PHP in CLI mode.
How can I fix this?
Issue
I don't have the slightest clue, how you managed to end up with a Windows DLL on Mac, but...
/usr/local/Cellar/php70/7.0.14_7/lib/php/extensions/
indicates that you are using Mac/Homebrew.
no-debug-non-zts-20151012/php_intl.dll indicates that you are trying to load a Windows DLL
The extension you are trying to use is build/compiled for another operating system. PHP can't load that file.
That's the reason for the Warning: PHP Startup: Unable to load dynamic library.
Solution
Install via Homebrew
brew update
brew install icu4c
or Install via PECL
sudo pecl update-channels
sudo pecl install intl
Then add extension=php_intl.so to your php.ini,
Or that full path mess: extension=/usr/local/Cellar/php70/7.0.14_7/lib/php/extensions/no-debug-non-zts-20151012/php_intl.so

The requested PHP extension intl is missing from your system (SonataAdminBundle) in Symfony2

I try to install the sandbox but I get the following error from composer:
Loading composer repositories with package information Installing
dependencies from lock file Your requirements could not be resolved to
an installable set of packages.
Problem 1
- Installation request for sonata-project/intl-bundle 2.1.0 -> satisfiable by sonata-project/intl-bundle 2.1.0.`
- sonata-project/intl-bundle 2.1.0 requires ext-intl * -> the requested PHP extension intl is missing from your system.`
Problem 2
- sonata-project/intl-bundle 2.1.0 requires ext-intl * -> the requested PHP extension intl is missing from your system.`
- sonata-project/news-bundle 2.1.x-dev requires sonata-project/intl-bundle 2.1.* -> satisfiable by sonata-project/intl-bundle 2.1.0.
- Installation request for sonata-project/news-bundle 2.1.
I had the same problem while I was installing new Magento 2.0, after different hit and trials, I manged to solve it by following these steps:
I copied all icu* files from php directory to Appache directory, and it worked.
Php direcotry:
WAMP\bin\php\php5.5.12
Appache Directory:
WAMP\bin\apache\apache2.4.9
Make sure to un-comment following line in php.ini file:
extension=ext/php_intl.dll
Linux user
yum install php-intl
Like #Hugehornet pointed out - you should enable this extension in php.ini by uncommenting this line: extension=ext/php_intl.dll
If you use wamp's interface for this task you are actually updating the php.ini file located in apache's directory.
Example: C:\wamp\bin\apache\Apache2.4.4\bin\php.ini
Composer is using the one located in the php's installation directory.
Example: C:\wamp\bin\php\php5.4.12\php.ini
You should manually edit the latter and restart the wamp server.
You need to enable the intl extension in php just as the error says.
In your php.ini file, uncomment the line extension=ext/php_intl.dll or something like this.
Edit : note that if you are using wamp or something like this, you should be aware of the fact that the php.ini file in the wamp config is not necessarily the one used by composer.
First of all be sure that your server is isung x86 build (intl not working with x64), then:
activate intl extension in php.ini directly
copy all icu*.dll form php directory to apache directory
make sure your console using the same php folder you just configured
source.
In my windows system I have two php.ini files at the flowing paths:
C:\wamp\bin\php\phpx.y.z
C:\wamp\bin\apache\Apachex.y.z\bin
I don't know which one is in your path. Just make sure to add the extension in both of them to eliminate any doubt.
I am on a Mac OS X Yosemite, and I fix this error
the requested PHP extension mcrypt is missing from your system
by running the following commands :
brew update
brew upgrade
brew tap homebrew/dupes
brew tap josegonzalez/homebrew-php
brew install php54-mcrypt
If intl has already been enabled and it doesn't works, add your PHP directory in the Path environment variable, then restart your server.
(for example C:\Program Files\wamp\bin\php\phpX.XXX.XXX for wamp)
It has worked for me!
On Ubuntu, Debian, and related Linux distributions
sudo apt-get install php-intl
to install the extension for the default PHP version.
For other versions a variation like apt-get install php7.3-intl will choose the correct extension if the version provided is correct.

How do I install Sylius on Bluehost or any other server that has an old version of ICU installed?

I have been trying to get Sylius installed on my Bluehost server which is running on shared hosting and while I do have SSH access, it is somewhat limited. It did not come with the php intl extension and the version of ICU on it is 4.2 which produces errors when installing Sylius because it wants a newer version.
I tried this on a clean install of Sylius on my Bluehost server and got it to work.
I had previously installed the intl extension on my BlueHost server following https://my.bluehost.com/cgi/help/534
The intl extension is not required. See below. (I was attempting to install it before I realized I didn't need it)
After installing the extension, phpinfo() said the version of ICU was 4.2.
Note: on BlueHost you have to use php-cli instead of php to run php scripts from the command line
To install Sylius I ran:
wget http://getcomposer.org/composer.phar
php-cli composer.phar create-project sylius/sylius -s dev
When running create-project, I recieved the error:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for symfony/icu 1.2.x-dev -> satisfiable by symfony/icu[1.2.x-dev].
- symfony/icu 1.2.x-dev requires lib-icu >=4.4 -> the requested linked library icu has the wrong version installed or is missing from your system, make sure to have the extension providing it.
Problem 2
- symfony/icu 1.2.x-dev requires lib-icu >=4.4 -> the requested linked library icu has the wrong version installed or is missing from your system, make sure to have the extension providing it.
- symfony/intl 2.3.x-dev requires symfony/icu >=1.0-RC,<2.0 -> satisfiable by symfony/icu[1.2.x-dev].
- Installation request for symfony/intl 2.3.x-dev -> satisfiable by symfony/intl[2.3.x-dev].
I then used cd sylius to move into the new directory made from the partial project install.
From the section on http://symfony.com/doc/current/components/intl.html about ICU and deployment problems I added "symfony/icu": "1.1.*", (or add "symfony/icu": "1.0.*", if you do not have the intl extension installed) to the require section of composer.json
I then ran php-cli composer.phar update to get all the dependencies which takes a while (make sure you reference composer.phar correctly as it was downloaded into the parent directory)
After all the packages were downloaded, it asked for config parameters such as Database info
Then I ran php-cli app/console sylius:install
I ran php-cli app/console doctrine:fixtures:load and recieved the error:
[RuntimeException]
The country resource bundle could not be loaded for locale "en"
From info at https://github.com/symfony/symfony/issues/5279#issuecomment-12477297 and https://github.com/kbsali/sf2-icu I ran
wget https://github.com/kbsali/sf2-icu/tarball/master -O sf2-icu.tgz
tar xzvf sf2-icu.tgz
mv kbsali-sf2-icu-XXXX/4.2 vendor/symfony/symfony/src/Symfony/Component/Locale/Resources/data/
rm -rf kbsali-sf2-icu-XXXX sf2-icu.tgz
and then edited vendor/symfony/symfony/src/Symfony/Component/Locale/Locale.php and changed
const ICU_DATA_VERSION = '49';
to
const ICU_DATA_VERSION = '4.2';
I ran php-cli app/console doctrine:fixtures:load again and loaded all of the Data Fixures until LoadOrdersData failed with the error:
[ErrorException]
Warning: array_keys() expects parameter 1 to be array, object given in /home5/ozzieorc/public_html/sylius_clean/sylius/vendor/fzaninotto/faker/src/Faker/Provider/Base.php line 127
Then made the changes described at https://github.com/Sylius/Sylius/pull/216/files - hopefully this becomes part of the master branch and doesn't have to be changed when installing sylius
and ran php-cli app/console doctrine:fixtures:load a third time
I added my IP to the array of valid IP addresses in web/app_dev.php so I can run app_dev.php remotely from the BlueHost servers
In your browser you can go to web/app_dev.php and login to the admin area with
Username: sylius#example.com
Password: sylius
as the page suggests
Hopefully this helps anyone having problems with installing Sylius. It took me a while to figure it out. Let me know if there are any better ways of going about this.
Try this:
apt-get install php5-intl

Problems with lib-icu dependency when installing Symfony 2.3.x via Composer

I've had no problems installing Symfony 2.2.x using Composer, I've always just copied the stable version at http://symfony.com/download.
composer create-project symfony/framework-standard-edition myproject/ 2.2.1
(I have Composer installed globally)
Curious about 2.3.0-RC1 I figured this would go smoothly:
composer create-project symfony/framework-standard-edition mynewerproject/ 2.3.0-RC1
But got shutdown by the following errors:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- symfony/icu v1.2.0-RC1 requires lib-icu >=4.4 -> the requested linked library icu has the wrong version installed or is missing from your system, make sure to have the extension providing it.
- symfony/icu v1.1.0-RC1 requires lib-icu >=3.8 -> the requested linked library icu has the wrong version installed or is missing from your system, make sure to have the extension providing it.
- symfony/symfony v2.3.0-RC1 requires symfony/icu >=1.0,<2.0 -> satisfiable by symfony/icu[v1.1.0-RC1, v1.2.0-RC1].
- Installation request for symfony/symfony 2.3.* -> satisfiable by symfony/symfony[v2.3.0-RC1].
Do I need to tweak the composer.json file?
Solution Update
I was missing the php intl extension which provides lib-icu
So easy, install and configure the intl extension. As of PHP 5.3 the Intl extension is distributed by default, but some distributions, like MAMP, don't have Intl so you'll need to acquire it. I used PEAR:
My steps:
Install the Intl extension (maintained by PECL): $ pear install pecl/intl — you may have to add the pecl channel to pear first.
If you use MAMP and have never worked with pear/pecl check lullabot's helpful blog post; MAMP doesn't ship with the php source, so you have to download the source for your php version and move the source into /Applications/MAMP/bin/php/php[version]/include/php (as covered in the blog post)
PEAR couldn't find my php.ini, so I had to manually add extension=intl.so to php.ini. In MAMP you can edit php.ini easily by going to File > Edit Template > php.[version].ini
Command Line:
When using Composer or Symfony's Console CLI you'll also need Intl and since the php CLI usually uses a different php.ini you'll want to add the extension directive there too. To find your CLI's php.ini simply do $ php -i |grep php\.ini to discover the file path and add extension=intl.so to that php.ini as well.
To check if Intl is installed you can do $ php -m to check available modules.
update your php-intl extension, that's where the icu error comes from!
sudo aptitude install php5-intl // i.e. ubuntu
brew install icu4c // osx
check the extension is enabled and properly configured in php.ini aswell.
( hint: php-cli sometimes uses a different php.ini )
php.ini
extension=intl.so ; *nix
extension=php_intl.dll ; windows
[intl]
intl.default_locale = en_utf8
intl.error_level = E_WARNING
check your phpinfo() AND php -m from your terminal if the extension has been succesfully enabled.
Check your current intl versions from php with:
Intl::getIcuVersion();
Intl::getIcuDataVersion();
attention: not needed anymore ( symfony 2.3 has meanwhile been released )
add the minimum stability flag #dev or #rc to your dependency like this please:
composer create-project symfony/framework-standard-edition mynewerproject/ 2.3.*#dev
The default stability in composer is stable which symfony 2.3 branch is not currently ( it's #rc ). Read more an stability flags here.
Many applications will only be supporting "en" locale and will have no need for translation capabilities or php-intl. If this is you, or you can't install php-intl on your server, you can explicitly add symfony/icu ~1.0 to your composer.json. 1.0 does not require php-intl, whereas 1.1+ does.
If you don't need translation features:
$ php bin/composer.phar require symfony/icu ~1.0
Without this declaration and trying to install symfony/symfony 2.3 Composer may try to install symfony/icu ~1.2 which would require you to install php-intl.
This is explicitly covered more extensively in the Symfony Intl Component's docs under "ICU and Deployment Problems".
A solution regarding this or similar problems can be found here: ICU and Deployment Problems
The behavior of composer should be intelligent selecting the right icu-component:
symfony/icu 1.0.*: when the intl extension is not available
symfony/icu 1.1.*: when intl is compiled with ICU 4.0 or higher
symfony/icu 1.2.*: when intl is compiled with ICU 4.4 or higher
There should be (theoretically) no error installing symfony 2.3. with no intl-extension.
But you can be trapped when your development-environment differs from your production-server like mentioned in this article:
the development machines are compiled with ICU 4.4 or higher, but the server is compiled >with a lower ICU version than 4.4
the intl extension is available on the development machines but not on the server.
When you have no root-access to your production-server you can fix it as mentioned in this article. (tweaking composer.json)
Hope this additional information helped as it helped me for this special case with different environments.
Mac OS Mavericks comes with PHP 5.4.17 without intl. To get this, you'll have to follow those steps :
brew install icu4c
sudo pecl install intl
The path to the ICU libraries and headers is: /usr/local/opt/icu4c/
Edit /etc/php.ini and add extension=intl.so to the end.
I know that this answer may not be the correct answer to this person's problem, but it was the solution to my problem with the same title. I was able to fix this problem for myself by enabling the intl extension in php.ini and upgrading composer.
Upgrading composer.
php composer.phar self-update
Remove comment from this line (in php.ini):
extension=php_intl.dll
And also remove comment the these two lines below [intl] in (php.ini):
[intl]
intl.default_locale = en_utf8
intl.error_level = E_WARNING
And restart apache2 of course. :)
Additional Information:
If your using mac and installed php with Homebrew follow these steps:
(PHP 5.4)
$ brew install php54-intl
(PHP 5.5)
$ brew tap josegonzalez/php
$ brew tap homebrew/dupes
$ brew install josegonzalez/php/php55-intl
$ sudo apachectl restart
Restart apache.
A better solution is to fix your composer.json to the version required by the production server. First, determine the ICU version on the server:
1
2
$ php -i | grep ICU
ICU version => 4.2.1
Then fix the Icu component in your composer.json file to a matching version:
"require: {
"symfony/icu": "1.1.*"
}
Set the version to
"1.0." if the server does not have the intl extension installed;
"1.1." if the server is compiled with ICU 4.2 or lower.
Finally, run
php composer.phar update symfony/icu
on your development machine, test extensively and deploy again. The installation of the dependencies will now succeed.

Categories