I'm following this link to install this PHP extension but I'm stuck in the middle.
When I try to run this command pecl install intl I get this message:
Specify where ICU libraries and headers can be found [DEFAULT] :
And I don't know where the ICU libraries are located.
If I press Enter I get this error:
configure: error: Unable to detect ICU prefix or no failed. Please verify ICU install prefix and make sure icu-config works.
ERROR: `/private/tmp/pear/install/intl/configure --with-php-config=/usr/bin/php-config --with-icu-dir=DEFAULT' failed
How can I locate the correct path of ICU libraries ?
I'm using High Sierra and MAMP with PHP version 7.1
ICU stands for ICU - International Components for Unicode
Install it with brew
brew update
brew search icu # returns 'icu4c'
brew install icu4c
OR
Install it with pecl
sudo pecl update-channels
sudo pecl install intl
installing intl package on osx
EDIT: after a better look in php#5.6 it seems that it is already compiled with 'intl'
php -i | grep intl
... '--enable-intl' ...
So my answer is normally useless for php#5.6 (but can be useful in some cases I guess)
I'm facing the same issue today trying to switch from php56 to php#5.6.
After lot of digging, here is the workaround.
Make sure to have a clean install of php#5.6 and to have it at the current version
php -v
PHP 5.6.35 (cli) (built: Mar 31 2018 20:21:31)
Make also sure to have icu4c
brew update
brew install icu4c
Next, we will install and compile intl manually
cd /usr/local/src/
wget https://pecl.php.net/get/intl-3.0.0.tg
tar zxf intl-3.0.0.tgz
cd intl-3.0.0/
phpize --clean
phpize
./configure
And here is the trick, edit Makefile
vi Makefile
Modify the line CXXFLAGS as follow
CXXFLAGS = -g -O2 -std=c++11
AND the line CPPFLAGS as follow
CPPFLAGS = -DHAVE_CONFIG_H -DU_USING_ICU_NAMESPACE=1
Next, save, and compile
make
make install
And voila
Installing shared extensions: /usr/local/Cellar/php#5.6/5.6.35/pecl/20131226/
Don't forget to add extension="intl.so" to your php.ini
vi /usr/local/etc/php/5.6/php.ini
(and to restart apache)
Sources:
https://gist.github.com/redefinelab/4188331
https://github.com/Homebrew/homebrew-php/commit/d7a3e0b6487780e0d983b35b8f42aad0fd01bf78
download the version of PHP you use in XAMPP from php.net. I am using 7.3. This version worked for me: php-7.3,
I’m guessing if you follow the steps it might work for 7.0 or 7.2 as well.
Extract the tar.gz file using (I extracted it inside ~/Downloads/ folder )
tar -xzvf php-7.1.31.tar.gz
cd into the extracted folder
cd php-7.1.31
change to subfolder ext/intl
cd ext/intl/
Run these commands to build the extension
/Applications/XAMPP/bin/phpize
./configure --enable-intl --with-php-config=/Applications/XAMPP/bin/php-config --with-icu-dir=/Applications/XAMPP/xamppfiles/
make
sudo make install
you can now delete all files you downloaded and also the extracted folders.
Open /Applications/XAMPP/xamppfiles/etc/php.ini , and add extension=intl.so
That’s it! Restart your Apache using XAMPP GUI and it should work. You have to run these commands each time you install a new version of XAMPP.
Related
I have installed php7.4 via RHEL8's Default Stream using dnf.
I want to install the php's ssh2 module.
How do I install Pyrus (Pear2 Package Manager) on RHEL8 with php7.4?
When I tried: php pyrus.phar
I got the error message in command prompt: Could not open input file: pyrus.phar
I used:
updatedb
locate pyrus
Got nothing
So, what is the issue here?
Best Regards
Thayalan
I wanted to install php's ssh2 extension via Pyrus but I was having trouble with Pyrus. Therefore, I tried it without Pyrus. I preferred yum or dnf installation throughout. But, it was not possible for some. The following are how I have installed ssh2:
yum install make gcc php-devel php-pear
libssh2 package (ssh2 package needs it) installed by downloading the file https://libssh2.org/download/libssh2-1.10.0.tar.gz into an appropriate folder.
Then, I entered the following commands:
tar -zxvf libssh2-1.10.0.tar.gz
cd libssh2-1.10.0
./configure
make
make install
ssh2 package installed by downloading the file https://pecl.php.net/get/ssh2-1.3.1.tgz into an appropriate folder.
Then, I entered the following commands:
tar -zxvf ssh2-1.3.1.tgz
cd ssh2-1.3.1
phpize
./configure
make
make test
make install
Then I entered the following entry into /etc/php.ini: extension=ssh2.so
After that, I restarted php by: systemctl restart php-fpm
And now, php's ssh2 extension has been successfully installed.
I am trying to install the zip and the intl extension for PHP 7.4.10
I run
sudo pecl install intl
and then the installation is requesting :
Specify where ICU libraries and headers can be found [DEFAULT] :
then I hit enter and continues but then it shows the next error:
configure: error: Package requirements (icu-uc >= 50.1 icu-io icu-i18n) were not met:
No package 'icu-uc' found
No package 'icu-io' found
No package 'icu-i18n' found
then I start to look how to install icu, I run:
brew install icu4c
the console shows:
If you need to have icu4c first in your PATH run:
echo 'export PATH="/usr/local/opt/icu4c/bin:$PATH"' >> /Users/user/.bash_profile
echo 'export PATH="/usr/local/opt/icu4c/sbin:$PATH"' >> /Users/user/.bash_profile
For compilers to find icu4c you may need to set:
export LDFLAGS="-L/usr/local/opt/icu4c/lib"
export CPPFLAGS="-I/usr/local/opt/icu4c/include"
For pkg-config to find icu4c you may need to set:
export .bash_profile="/usr/local/opt/icu4c/lib/pkgconfig"
I added all the paths to the .bash_profile config file and run:
source .bash_profile
at this point I am not sure what todo I am still receiving:
== Environment ==
!! php_extension zip !!
[System] must be installed and enabled - The Zip PHP extension is now required by Moodle, info-ZIP binaries or
PclZip library are not used anymore.
!! php_extension intl !!
[System] must be installed and enabled - Intl extension is required to improve internationalization support, such as
locale aware sorting and international domain names.
even after run sudo apachectl restart
also I have check a lot of guides to install the zip extension via php.ini adding extension=zip but is not working
any help will be appreciated
[UPDATE]I tried to use the fist answer to the post and I got after run all and the last command output was sudo pecl update-channels && sudo pecl install intl
checking for icu-uc >= 50.1 icu-io icu-i18n... no
configure: error: Package requirements (icu-uc >= 50.1 icu-io icu-i18n) were not met:
No package 'icu-uc' found
No package 'icu-io' found
No package 'icu-i18n' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables ICU_CFLAGS
and ICU_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
ERROR: `/private/tmp/pear/temp/intl/configure --with-php-config=/usr/local/opt/php/bin/php-config --with-icu-dir=/usr/local/opt/icu4c' failed
Is icu4c present on your system ? What is the output of:
which icu4c
If you have no output we can investigate further. A quick look at the ICU documentation tell us that the library relies on autoconf.
brew update
brew install autoconf automake libtool
brew install icu4c
Now let's check if icu4c is installed properly
which icu4c
If at this point you still have no output then it's better to install and compile icu4c from source.Because this library installed via Homebrew could be suffering from multiple issues.
wget https://github.com/unicode-org/icu/releases/download/release-67-1/icu4c-67_1-src.tgz
tar xvfz icu4c-67_1-src.tgz
cd icu/source
./configure --prefix=/usr/local/opt/icu4c/67_1 --enable-icu-config
sudo make && sudo make install
Afterwards you can resume
sudo pecl update-channels && sudo pecl install intl
If you will be asked
Specify where ICU libraries and headers can be found [DEFAULT] :
The answer is
/usr/local/opt/icu4c
When icu4c is installed with brew, it doesn't copy its files to pkg-config configuration directory.
So, another workaround would be to be to set the PKG_CONFIG_PATH to the folder where the lib is located. Example:
PKG_CONFIG_PATH=/usr/local/Cellar/icu4c/69.1/lib/pkgconfig/ pkg-config --cflags --libs libsoup-2.4
Using pecl install -n solr gives
No releases available for package "pecl.php.net/solr"
install failed
Also tried pear install pecl/solr which gives the same output :
No releases available for package "pecl.php.net/solr"
install failed
I'm using a Mac and php56.
Output of pecl -V
PEAR Version: 1.9.4
PHP Version: 5.6.25
Zend Engine Version: 2.6.0
Darwin Kernel Version 15.4.0: Fri Feb 26 22:08:05 PST 2016;
root:xnu-3248.40.184~3/RELEASE_X86_64 x86_64
Another important piece of information is that, pear and pecl were not available in my system, so I installed them using
sudo php /usr/lib/php/install-pear-nozlib.phar -d /usr/local/lib/php -b /usr/local/bin
Update
Tried sudo pecl install -n solr and now it seems to go one step further
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.
ERROR: phpize failed
Luckily stumbled upon
PEAR package install fails
which led to execute
pear list-upgrades which showed some kind of permission issue with cache directory, manually created the directory using sudo at the specified location (/private/tmp/pear/cache)
And then used sudo to install the solr extension as sudo pecl install -n solr which threw the following error :
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.
brew install autoconf followed by sudo pecl install solr worked.
How can I install Intl on my XAMPP server on OS X?
I tried modifying my XAMPP>etc>php.ini and uncommenting the line:
;extension=php_intl.dll
and restarting Apache, but it didn't work.
Installing "intl" extension on OSX.
Normally, the PHP is automatically installed on OSX.
So, if you would like to use the XAMPP, or whatever apache server, you must change the path point to XAMPP. You can check the path by using:
$ which php
You should get
/Applications/XAMPP/xamppfiles/bin/php
if not, you will get
/usr/bin/php.
This is OSX' php. So, you have to change it by using:
$ PATH="/Applications/XAMPP/xamppfiles/bin:${PATH}"
Now, it's time to install intl. Firstly, you need to install icu4c
$ brew install icu4c
It takes a couple of times and returns its path to you, should look something like this:
/usr/local/Cellar/icu4c/x.x.x
Next, let's install intl by using pecl
$ sudo pecl update-channels
$ sudo pecl install intl
It will prompt you to put the icu4c path.
After finish installing icu4c, put the following statement to php.ini
extension=intl.so
Restart apache. and check whether it's neatly installed.
$ php -m | grep intl
should return 'intl'
That's it!
On OSX if you have homebrew available and have PHP7:
$ brew install php70-intl // For PHP7.0
$ brew install php71-intl // For PHP7.1
For PHP5.5:
$ brew install php55-intl
Re-open your terminal window to ensure it works right in your session. To see if it loaded via your CLI interpreter:
$ php -m | grep intl
Or:
$ php -i "(command-line 'phpinfo()')" | grep intl
Source: https://daveismyname.blog/blog/install-php-intl-on-mac-using-homebrew
I failed on my XAMPP on Mac with:
$ brew install icu4c
, after which I've got message:
intl ICU version installed on your system is outdated (4.8.1.1) and does not match the ICU data bundled with Symfony (57.1)
I solved my problem by running command to download, unpack, compile and install ICU of required version (you can choose another version here http://site.icu-project.org/download if needed, file should ends with ...src.tgz):
$ curl -sS -o /tmp/icu.tar.gz -L http://download.icu-project.org/files/icu4c/57.1/icu4c-57_1-src.tgz && tar -zxf /tmp/icu.tar.gz -C /tmp && cd /tmp/icu/source && ./configure --prefix=/usr/local && make && sudo make install
than run:
$ sudo pecl install intl
and specified where ICU libraries and headers can be found [DEFAULT] :
/usr/local
then edited 'php.ini' with extension=intl.so and reboot apache.
Checked result with:
<?php
if (extension_loaded('intl')) {
echo "PHP: " . PHP_VERSION . "<br>\n";
echo "ICU: " . INTL_ICU_VERSION . "<br>\n";
} else {
die('OOPS! The intl extension is not enabled!');
}
How can I install or enable the PHP Pecl Intl extension in my PHP environment?
I've got a stock PHP configuration that came bundled with Mac OS X Snow Leopard.
Installing libicu from source and than $pecl install intl results in the following error:
/private/tmp/pear/temp/intl/collator/collator_class.c:92: error: duplicate 'static'
/private/tmp/pear/temp/intl/collator/collator_class.c:96: error: duplicate 'static'
/private/tmp/pear/temp/intl/collator/collator_class.c:101: error: duplicate 'static'
/private/tmp/pear/temp/intl/collator/collator_class.c:107: error: duplicate 'static'
make: *** [collator/collator_class.lo] Error 1
ERROR: `make' failed
Any help is really appreciated!
Here's what I did in OSX 10.9 Mavericks:
Install some dependencies with Homebrew:
$ brew install autoconf
$ brew install icu4s
$ brew link --force icu4s
Install and verify Pear/PECL (instructions from http://techtastico.com/post/como-instalar-pear-y-pecl-en-os-x-mavericks/):
$ curl -O http://pear.php.net/go-pear.phar
$ sudo php -d detect_unicode=0 go-pear.phar
[ Select 1 and enter /usr/local/pear ]
[ Select 4 and enter /usr/local/bin ]
[ Press return ]
$ pear version
Install PECL intl:
$ sudo pecl install intl
$ sudo cp /private/etc/php.ini{.default,}
$ sudo chmod 644 /private/etc/php.ini
$ echo extension=intl.so >> /private/etc/php.ini
For the time being I've recompiled my PHP installation. I've created a gist with my configure string which I'll keep updating.
update
liip have created a nice binary that circumvents all these troubles. It is based on the original entropy.ch binary, I recomend using it for PHP development on a Mac.
Better late than never, but if you are like me and installed PHP directly from php.net (instead of using something like Homebrew or Port, then you can simply follow the following link to install Pear and PECL:
http://akrabat.com/php/setting-up-php-mysql-on-os-x-10-7-lion/
It worked fine for me.
on my Mac I installed a php version with pear using brew. This solved all my issues as the default osX php didn't work for me after trying many different ways. You can try without installing php/pear if you have already done so.
You need Homebrew http://brew.sh/
Install PHP
brew install php56 --with-pear or brew install php56 pear
Install autoconf
brew install autoconf
Install icu4c
brew install icu4c
Creates the symlinks
brew link --force icu4c
Install intl with (pearl) pecl
sudo pecl install intl
Homebrew should enable intl and symlink all the right versions to their respective commands.